Running ActiveX Command Button

Dixie1978

New Member
Joined
Mar 14, 2019
Messages
9
Hi

I've a Macro called Sheet3. Find_First2

I've set up a user form and in it there's a command button that I need to run the above macro.
I'm using the below code but won't work for me, just highlights in yellow.

Private Sub CommandButton1_Click()
Sheet3.First2
Unload Me
End Sub

Any advice would be great
 

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".
Hi,
this is due to the macro name.
You should not use a name with dots.
Name a macro something like FindFirstTwo
and it should work

HTH
 
Upvote 0
Sorry, forgot to say.
I've written the code for this macro in Sheet3 so this is the name it automatically saved as. So the macro is actually called Find_First2 but when I look in my macros list it's saved as Sheet3.Find_First2. Is there a way around this.
 
Upvote 0
Hi,
yes. You just need to

Sub MyNewMakroName()
'here the code of your recorded Makro


End Sub
 
Upvote 0
Yeah, took the code out of the sheet and put it in a module. Kept saving with sheet3 in front of it when was in the sheet code
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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