ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro: automatically initiating upon cell click (https://www.excelbanter.com/excel-discussion-misc-queries/123888-macro-automatically-initiating-upon-cell-click.html)

pmp613

Macro: automatically initiating upon cell click
 
Hi - a newbie question:
I have a calendar macro which I want to kick off when a cell in the date
column on my worksheet is selected.

How do I do this, so the user of the sheet won't need to do anything more
than click on the cell, and then select the date from the popup?

Many, many thanks!
Ted

Gary''s Student

Macro: automatically initiating upon cell click
 
This uses column E:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Columns("E")) Is Nothing Then
Exit Sub
End If
Application.EnableEvents = False
MsgBox ("Hello")
Application.EnableEvents = True
End Sub

Paste the sub into worksheet code. When you click on any cell in column E
the macro will fire. Adapt as you like.

REMEMBER: Worksheet code.
--
Gary's Student


"pmp613" wrote:

Hi - a newbie question:
I have a calendar macro which I want to kick off when a cell in the date
column on my worksheet is selected.

How do I do this, so the user of the sheet won't need to do anything more
than click on the cell, and then select the date from the popup?

Many, many thanks!
Ted



All times are GMT +1. The time now is 04:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com