Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assign Macro to a Command Button

Status
Not open for further replies.

smil3y

IS-IT--Management
Jan 8, 2004
79
0
0
AU
I have a personal.xls file which is contained in the XLstart folder. This file contains all my commonly used macros. Until now I have only run the macros via the Tools/Macro/run selection.

I have inserted a button on a spreadsheet (Equipment.xls)and need to assign a macro that is in personal.xls. My code is:

Private Sub cmdPopulate_Click()
Copyitmotor
End Sub

I get a function or sub not defined error because the macro is in the personal.xls file.

Can someone please advise the format for correctly assigning the macro.

Thanks
 
You may try this:
Application.Run "personal.xls!Copyitmotor"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top