Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Assign MAcro to command button


Hi, I have a macro in my workbook called REV,

I need to assign this macro to a commnd button.
The following is what I have so far, am clearly missing something
cos' its not quite working.

Many Thanks


Private Sub CommandButton1_Click()
REV
End Su

--
T De Villier
-----------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...fo&userid=2647
View this thread: http://www.excelforum.com/showthread.php?threadid=56844

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Assign MAcro to command button

Any error message?

T De Villiers wrote:
Hi, I have a macro in my workbook called REV,

I need to assign this macro to a commnd button.
The following is what I have so far, am clearly missing something
cos' its not quite working.

Many Thanks


Private Sub CommandButton1_Click()
REV
End Sub


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=568442


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Assign MAcro to command button

Many ways to do it but the easiest is.....

From the toolbar menu select the forms toolbar

then pick command button to draw.
If should give you option to pick macro and assign if not right click
on it.

wrote:
Any error message?

T De Villiers wrote:
Hi, I have a macro in my workbook called REV,

I need to assign this macro to a commnd button.
The following is what I have so far, am clearly missing something
cos' its not quite working.

Many Thanks


Private Sub CommandButton1_Click()
REV
End Sub


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=568442


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Assign MAcro to command button

There are two kinds of command buttons. i am assuming that you grabbed your
button from the Control Toolbox and placed it on a sheet. When you do this
your sheet will be in design mode. If you right click on that button you can
change the properties and view the code. Select View code. It will take you
to the VBE and should have a stub entered for you similar to the code that
you posted... In that code add the line...

msgbox "tada"

and go back to your sheet. Exit design mode by clicking the Triangle icon on
the control toolbox. Now when you click the button your message box should
show up. Swap out the message box for REV and you should be off to the
races... If something crashes or does not work along the way post back...
--
HTH...

Jim Thomlinson


"T De Villiers" wrote:


Hi, I have a macro in my workbook called REV,

I need to assign this macro to a commnd button.
The following is what I have so far, am clearly missing something
cos' its not quite working.

Many Thanks


Private Sub CommandButton1_Click()
REV
End Sub


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=568442


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Assign MAcro to command button


Many Thanks for thi

--
T De Villier
-----------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...fo&userid=2647
View this thread: http://www.excelforum.com/showthread.php?threadid=56844



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default Assign MAcro to command button

How do you call a macro with arguments in a Command Button on Sheet1
which references Cell A1 value "Supplies".
'Target' would pass A1 value

Example
Public Sub Cmd_Services_Click(ByVal Target As CommandButton)
'run code in Sheet1
ABC(Target)
End Sub

In the properties window for command button, Name = Cmd_Services
Should it be Name - Cmd_Services(A1) ?
Cmd_Services(Sheet1!A1) ?

I'm Frustrated
--
Jeff :-)


"Jim Thomlinson" wrote:

There are two kinds of command buttons. i am assuming that you grabbed your
button from the Control Toolbox and placed it on a sheet. When you do this
your sheet will be in design mode. If you right click on that button you can
change the properties and view the code. Select View code. It will take you
to the VBE and should have a stub entered for you similar to the code that
you posted... In that code add the line...

msgbox "tada"

and go back to your sheet. Exit design mode by clicking the Triangle icon on
the control toolbox. Now when you click the button your message box should
show up. Swap out the message box for REV and you should be off to the
races... If something crashes or does not work along the way post back...
--
HTH...

Jim Thomlinson


"T De Villiers" wrote:


Hi, I have a macro in my workbook called REV,

I need to assign this macro to a commnd button.
The following is what I have so far, am clearly missing something
cos' its not quite working.

Many Thanks


Private Sub CommandButton1_Click()
REV
End Sub


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=568442


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
Assign a macro to a command button SheriTingle Excel Discussion (Misc queries) 4 September 25th 06 06:38 PM
Assign Macro to Command Button adamaagard Excel Programming 2 February 11th 06 04:36 PM
Assign a macro to a command button Tom E Excel Programming 3 July 8th 05 08:31 PM
command button and assign macro Dave Peterson[_3_] Excel Programming 2 May 27th 04 03:01 AM
Assign Macro to Command Button Shunt Excel Programming 1 August 7th 03 02:07 PM


All times are GMT +1. The time now is 10:21 PM.

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"