Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I initiate a macro directly in a worksheet?
I would like to click on a cell and initiate a macro. Is it possible?
|
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I initiate a macro directly in a worksheet?
All you need is a Command Button. Click on "View/Toolbars/Control Toolbox.
You will see, among others, the Command Button icon. Click it and click on the sheet where you want the button. When you double-click the button a Macro will be set up for you to place your code in. If you right-click the button and choose "Properties" you can change the Caption on it etc. -- Best wishes, Jim "AMMPro" wrote: I would like to click on a cell and initiate a macro. Is it possible? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I initiate a macro directly in a worksheet?
Think your after Event Procedures. Attached is a link which has a demo of the code. The code is pasted into the sheet that the change occurs in and not module. http://www.cpearson.com/excel/events.htm VBA Noo -- VBA Noo ----------------------------------------------------------------------- VBA Noob's Profile: http://www.excelforum.com/member.php...fo&userid=3383 View this thread: http://www.excelforum.com/showthread.php?threadid=56178 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I initiate a macro directly in a worksheet?
Hi AMMPro,
Try: '============= Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim rng As Range Set rng = Me.Range("A1") '<<==== CHANGE If Not Intersect(Target, rng) Is Nothing Then Call MyMacro End If End Sub '<<============= This is worksheet event code and should be pasted into the worksheets's code module (not a standard module and not the workbook's ThisWorkbook module): Right-click the worksheet's tab Select 'View Code' from the menu and paste the code. Alt-F11 to return to Excel. --- Regards, Norman "AMMPro" wrote in message ... I would like to click on a cell and initiate a macro. Is it possible? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Initiate Macro On Save | Excel Programming | |||
How can a macro automatically initiate uponing a file? | Excel Discussion (Misc queries) | |||
How do I initiate the windows printer select object in Excel macro | Excel Programming | |||
Macro to initiate a spreadsheet to email | Excel Programming | |||
Initiate Macro Formula :: Combo Boxes | Excel Programming |