can vba "click" a button

tim963

Board Regular
Joined
Aug 20, 2002
Messages
58
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
 
Re: can vba "click" a button

Nice work. I got away with just:

Sheets(3).CommandButton1 = True

In my case, I'm in a userform and I'm invoking a CommandButton on a particular sheet.
Works great. I'm not sure about the "vbClick" line.

Is that necessary?
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Re: can vba "click" a button

Thanks all, perfect thread

I'm new to vba and have used maybe 5 userforms in my life. Just wrote some code to run once a commandbutton is click. I then realized that wouldn't it be great if this code ran all on tis own as the form opens. Perfect!

thanks all. It's great when I can do a simple search and find the answer to my question. I love it
 
Upvote 0

Forum statistics

Threads
1,214,386
Messages
6,119,217
Members
448,876
Latest member
Solitario

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