Exce; - Urgent - Run-Time Error 424 Object (VBA)

  • Thread starter Thread starter ajw150
  • Start date Start date
A

ajw150

Hi,

Please can someone help me (and a few others by the looks of it) wit
an error I keep receiving. I have followed all the instructions in th
Course booking Example for creating a user form, but when it comes t
assigning the macro, it doesnt work. I then get the Run-time Error
424, Object undefined?

Please could someone tell me what I am doing wrong.

Thanks

Andre

Attachment filename: testa.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=54132
 
ajw150

Check your form name


Sub OpenStartdata()

frmStartdata.Show ' invalid form name

End Sub


should be

Sub OpenStartdata()

Startdata.Show ' valid form name

End Su
 
Hi,

Just one last point.

I have found that, once the data has been entered into the userform an
the OK button is pressed, the user is automatically taken to the shee
where the new data has been added. I would like the user to return t
the sheet where they originated from, i.e macro location, how would
do this?

Really appreciate all your help.

Thanks

Andre
 
ajw150

Using your code You would need to get the name of the active shee
before you activate sheet1 then activate that sheet after pastinging i
your data.

or you can replace your
Private Sub cmdOK_Click()

code with my version which puts your data on sheet1 without activatin
sheet1 which should solve your problem




Private Sub cmdOK_Click()

Dim wS As Worksheet
Dim lRow As Long

Set wS = ActiveWorkbook.Sheets("Sheet1")
l = Range("A" & Rows.Count).End(xlUp).Row + 1
wS.Cells(lRow, "a") = txtLMName.Value
wS.Cells(lRow, "b") = txtPName.Value
wS.Cells(lRow, "c") = txtAddress.Value
wS.Cells(lRow, "d") = txtAdd.Value
wS.Cells(lRow, "e") = txtemail.Value
wS.Cells(lRow, "f") = txtLMemail.Value
End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Run time error 424 0
Run-Time Error 424 2
Time formatting 2
Excel Count Problem 1
Run Time Error 424 2
Autofill with multiple filenames 3
Calculating Time over days 2
Need a macro to run sort automatically 1

Back
Top