Macro: automatically initiating upon cell click

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top