=> VB Command button to Execute Excel Macro

R

Rhonda Fischer

Hello,

I am attempting to execute an Excel Macro using the
on_click event of a VB button. I have not as yet had
much success. I am able to get as far as drawing the
VB button on the Excel spreadsheet in design mode,
however on execution the Macro1 is not recognised.

Any suggestions would be very much appreciated.

Thank you kindly
Rhonda
 
B

Bob Phillips

Rhonda,

By virtue of you mentioning design mode, I assume you mean control buttons,
not forms.

After drawing the button, whilst still in design mode, double-click the
button, and you will be taken to the worksheet code module, with a skeleton
event code macro for that button already created

Private Sub CommandButton1_Click()

End Sub

Just add your code, or a call to you macro, in that event macro.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top