Runtime Error 424: Object Required - help with starting User Form

BLyons14

New Member
Joined
Dec 30, 2014
Messages
6
Every time I try to run this application that I created, I am getting this error. I am VERY new to VBA (as in...I began using it yesterday) so I really don't have any idea what I'm doing. I copied a basic format that I found online and tailored it to my needs.

I am trying to start a userform that, after the user populates and hits submit, will automatically fill in on another worksheet. The problem is that when I hit the "start" button (which should start the app), it comes up with this error.

This is the code I have for the "start" command button:

Sub CommandButton1_Click()


CoaterUserForm.Show


End Sub


When I hit debug, the "CoaterUserForm.Show" line is highlighted and an arrow pointing at it.

Again, please bear with me because I am very new. Please explain everything you can in simple terms! This may be a simple, obvious fix - but I can't figure it out.

Thanks!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
First, are you certain that that is the correct name of your form? If so, when the error arises, click debug, then press f8 to step into the actual userform code and see which line is really causing the error - probably in the Initialize or Activate events of the form.
 
Upvote 0
That is the name on the left side list when I'm in VBA and in the "Name" section of the properties list. I think it is the correct name.

When I press F8, that same line is highlighted in yellow AND red and there is a little red dot on the left.
 
Upvote 0
Do you have any code in the userform's Initialize or Activate events?
 
Upvote 0
This is the code for the UserForm Initialize event:


Code:
Private Sub UserForm_Initialize()
'Empty NameBox
NameBox.Value = ""


'Empty DateBox
DateBox.Value = ""


'Empty BatchBox
BatchBox.Value = ""




'Empty LinearMeterBox
LinearMeterBox.Value = ""


'Empty LineSpeedBox
LineSpeedBox.Value = ""


'Empty OrderBox
OrderBox.Value = ""


'Empty OrderYardsBox
OrderYardsBox.Value = ""


'Empty RollBox
RollBox.Value = ""


'Empty SquareMeterBox
SquareMeterBox.Value = ""


'Empty WidthBox
WidthBox.Value = ""


'Empty ActivityList
ActivityList.Clear


'Fill ActivityList
With ActivityList
    .AddItem "Operations"
End With


'Empty ProductList
ProductList.Clear


'Fill ProductList
With ProductList
    .AddItem "Products"
End With
        
'Set partial order as default
OptionButton1.Value = True


End Sub
 
Last edited by a moderator:
Upvote 0
I actually figured it out just now. I looked back at another bunch of code and saw that I have a line in there that wasn't necessary. Now, the user form loads, but I get an error after I hit submit. It says:

Compile Error:
End If without block If

Can I just get an explanation on what this means? I can try to troubleshoot it myself but I don't quite understand what it's telling me.
 
Upvote 0
The red highlight and dot is a breakpoint - you can click the red dot to clear it again.

In the VB Editor, click Tools - Options, switch to the General tab and alter the Error Trapping options to 'Break in class module' then click your startup button again.

Your error usually means that you have an If clause where the Then clause appears on the same line, in which case you don't use an End If. In other words you have something like:
Code:
If something then do something
end if
but it should either be just:
Code:
If something then do something
or:
Code:
If something then 
do something
End If
 
Last edited:
Upvote 0
Can you post the code for the submit button?
 
Upvote 0
RoryA, thanks for the explanation. I took out the End If and that error code went away.
Thanks again for the help. Like I said, most of this is probably obvious to seasoned veterans but it's a huge mystery to me ;)
 
Upvote 0

Forum statistics

Threads
1,212,928
Messages
6,110,737
Members
448,295
Latest member
Uzair Tahir Khan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top