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

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
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,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

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