Macro view not showing Userform macro

Metaripley

Board Regular
Joined
Dec 31, 2014
Messages
93
Ive got a userform which runs if i press the play button within VBA.
But I want to connect it to a button on the worksheet.
And in the macro vieuw list it is not showing.
The code is in the Userform code.
Removing the "Private" dosnt work.

Code:
Private Sub UserForm_Initialize()




End Sub




Private Sub CommandButton2_Click()


' Hide the Userform and set cancelled to true
    Hide
    m_Cancelled = True


End Sub
 
Last edited:

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Re: Macr vieuw not showing Userform macro

To show a userform you should have another routine that looks something like this:

Code:
Sub ShowMyForm()
Userform1.Show
End Sub

and assign that to your button.
 
Upvote 0
Re: Macr vieuw not showing Userform macro

You need to call the userform from another routine...

Code:
Sub OpenMyForm

MyFormName.Show

End Sub

Then link your button to the OpenMyForm routine
 
Upvote 0
Re: Macr vieuw not showing Userform macro

You should have a script like this in your button:

UserForm1.Show

The initialize code goes in the Userform and runs when the UserForm opens.
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,509
Members
448,967
Latest member
screechyboy79

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