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
 

Some videos you may like

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

silentwolf

Well-known Member
Joined
May 14, 2008
Messages
1,123
Office Version
  1. 2016
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
 

Dixie1978

New Member
Joined
Mar 14, 2019
Messages
9

ADVERTISEMENT

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.
 

silentwolf

Well-known Member
Joined
May 14, 2008
Messages
1,123
Office Version
  1. 2016
Hi,
yes. You just need to

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


End Sub
 

silentwolf

Well-known Member
Joined
May 14, 2008
Messages
1,123
Office Version
  1. 2016
Hi,
Thanks for the feetback.
I guess you worked it out now! :)
 

Dixie1978

New Member
Joined
Mar 14, 2019
Messages
9
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
 

Watch MrExcel Video

Forum statistics

Threads
1,108,993
Messages
5,526,114
Members
409,685
Latest member
Bellybb

This Week's Hot Topics

Top