#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default userform

G'day Group,
How is a connection from a command button made to a macro.
For instance if I wanted to push a button to run a macro that I created by
using the recorder.
Thanks
Bruce


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default userform

Bruce

The commandbuttons on userforms use events (as do all controls).
Specifically, you want the Click event of the commandbutton. Right-click on
the commandbutton and choose View Code.

Now you have two options (at least). You can paste your recorded code into
the Click event, or you can call your recorded macro from within the event
sub. If you paste, be sure to omit the Sub and End Sub lines from the
recorded macro. The Sub line for event macro is pre-defined and should not
be altered.

To call the recorded macro (let's say it's named macro1), the event sub
would look like this:

Private Sub CommandButton1_Click()
macro1
End Sub

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Bruce Minty" wrote in message
...
G'day Group,
How is a connection from a command button made to a macro.
For instance if I wanted to push a button to run a macro that I created by
using the recorder.
Thanks
Bruce




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA userform jcheko Excel Worksheet Functions 1 April 24th 08 08:38 PM
Userform to appear on top? capt Excel Discussion (Misc queries) 6 February 24th 08 02:53 PM
Userform Freshman Excel Worksheet Functions 4 November 9th 06 01:04 PM
userform carwincarber New Users to Excel 0 October 23rd 05 06:59 PM
userform Tom Ogilvy Excel Programming 1 September 2nd 03 10:12 PM


All times are GMT +1. The time now is 09:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"