How would you run “CommandButton1_Click” from VBA, I want the Marco to “Click” the button on a user form, I have tried Application.Run "CommandButton1_Click" but it will not work I get “Marco commandbutton1_Click can not be found. Thanks excel ‘97
After many hours and a sinking feeliing it would never work, I solved my own problem :D
Clicking a worksheet CommmandButton to force a Form based CommandButton to 'click' was achieved with VBA with these two lines inside the worksheet CommandButton's click event:
UserForm1.CommandButton2 = True
UserForm1.CommandButton2 = vbClick
There are references on the web saying you can just do this:
UserForm1.CommandButton2_Click, or
Call UserForm1.CommandButton2_Click
but they didn't work
[B][COLOR=Red]Public[/COLOR][/B] Sub CommandButton2_Click()
'your code here.
End Sub
UserForm1.CommandButton2_Click
After many hours and a sinking feeliing it would never work, I solved my own problem :D
Clicking a worksheet CommmandButton to force a Form based CommandButton to 'click' was achieved with VBA with these two lines inside the worksheet CommandButton's click event:
UserForm1.CommandButton2 = True
UserForm1.CommandButton2 = vbClick
There are references on the web saying you can just do this:
UserForm1.CommandButton2_Click, or
Call UserForm1.CommandButton2_Click
but they didn't work