Userform Failing

sassriverrat

Well-known Member
Joined
Oct 4, 2018
Messages
655
Good Morning,

I have three userforms that are failing-

Userform1 opens and you should click the button- which should take you to Userform4, which has a button that should take you to Userform2. If the document has a different name (as specified in the coding below), only Userform2 Opens (this works) and based on if Userform1 opened or not (again- name based), cmdbutton1 has two different macros it could run.

Code:
Private Sub Workbook_Open()
Application.Visible = False
If ActiveWorkbook.name = "Master Voyage Report.xlsm" Then
   Userform4.Show
ElseIf ActiveWorkbook.name = "Current Voyage Report.xlsm" Then
   Userform2.Show
   Application.Visible = True
Else: Userform3.Show
   Application.Visible = True
End If 
End Sub



so here is the problem- Userform1 is giving me an error 13 when i click the CMDButton1 - It highlights "Userform4.Show"

Code:
Private Sub CommandButton1_Click()
Application.Visible = False
Userform4.Show
Unload me
End Sub

2nd Problem- I can't get the captions for CMDButtons 3 and 4 in Userform 4 to input- the buttons stay blank. See Code below
Code:
Private Sub Userform_Initialize()
Me.CommandButton3.Caption = ThisWorkBook.Sheets("Notes").Range("K18")
Me.CommandButton4.Caption = ThisWorkBook.Sheets("Notes").Range("L18")
End Sub

thanks
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Are you sure there aren't any errors in those two cells? That would explain the Type mismatch error when you try to load userform4.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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