Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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
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
Initiate Macro On Save JTWood Excel Programming 2 June 14th 06 03:47 PM
How can a macro automatically initiate uponing a file? kanye Excel Discussion (Misc queries) 5 April 27th 05 11:45 PM
How do I initiate the windows printer select object in Excel macro Mick B[_2_] Excel Programming 1 January 13th 05 09:46 PM
Macro to initiate a spreadsheet to email Rich F[_2_] Excel Programming 2 November 12th 04 07:00 PM
Initiate Macro Formula :: Combo Boxes lykwid Excel Programming 1 January 23rd 04 05:31 PM


All times are GMT +1. The time now is 07:26 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"