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!
 

Some videos you may like

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,793
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
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.
 

BLyons14

New Member
Joined
Dec 30, 2014
Messages
6
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.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,530
Office Version
365
Platform
Windows
Do you have any code in the userform's Initialize or Activate events?
 

BLyons14

New Member
Joined
Dec 30, 2014
Messages
6
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:

BLyons14

New Member
Joined
Dec 30, 2014
Messages
6
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.
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,793
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
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:

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,530
Office Version
365
Platform
Windows
Can you post the code for the submit button?
 

BLyons14

New Member
Joined
Dec 30, 2014
Messages
6
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 ;)
 

Watch MrExcel Video

Forum statistics

Threads
1,095,144
Messages
5,442,634
Members
405,188
Latest member
maluenmaluen19

This Week's Hot Topics

  • Copy entire row if CountA <>0 to another sheet
    [B]I want to copy entire row if CountA <>0 for column J7:AM7 (headers on J6:AM6) and so on till the last used cell is column D and paste the...
  • Select last used Row in Table
    I have created a Table in a Worksheet which is locked to prevent user errors and protect formula. Some of the cells require freetext entries which...
  • excel workbook: do not allow certain file name
    Hello all, Don't think this has ever been asked before, but how do I restrict file save [Before_Save Event] if the name of the file being saved...
  • fixing problem autofilter
    hello i need help about my code when i search by code in textbox it doesn't show anything this is my data [ATTACH type="full"...
  • “Weight”
    Hi, i’ve got a long sheet filled with weights such as kg,g,L & ml. i can build a formula to convert kg into g and liter into ml. How ever, my...
  • How to capitalize everything before a certain character?
    In column A, I have some text: Hello good day.mp3 Hello good day.flac etc. I'd like to capitalize everything before the period. I don't need the...
Top