Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to run a macro upon a cell click

I have a macro that runs a pop-up calendar and applies the date selected
from within the calendar to the currently selected cell.

As default I have to run this manually via tools macromacrosrun.

My question is, how do I force this so that as soon as the user clicks on
the cell that particular macro (OpenCalendar) is run and the calendar is
opened for populating the cell that has just been clicked.

If possible i'd also like to limit any user entry for certain cells other
than that populated by the calendar macro.

Thanks in advance


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default How to run a macro upon a cell click

Right click the sheet tab and select view code. This take you to the VBE.
Just above the Code Window are 2 drop down combo's. Change the one on the
left to Worksheet. This gives you access to worksheet event code. The
different events are listed in the drop down on the right. When you select
one it will drop a code stub in for that event. Note that for selection
change there is an arguement Target which is the cell(s) that were just
selected...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
MsgBox Target.Address
End Sub

So you want something like...
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$1" then Call OpenCalendar
End Sub


--
HTH...

Jim Thomlinson


"Banzai" wrote:

I have a macro that runs a pop-up calendar and applies the date selected
from within the calendar to the currently selected cell.

As default I have to run this manually via tools macromacrosrun.

My question is, how do I force this so that as soon as the user clicks on
the cell that particular macro (OpenCalendar) is run and the calendar is
opened for populating the cell that has just been clicked.

If possible i'd also like to limit any user entry for certain cells other
than that populated by the calendar macro.

Thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default How to run a macro upon a cell click

See how Ron de Bruin does it.

http://www.rondebruin.nl/calendar.htm

Note the "more information" link to download mscal.ocx if needed.


Gord Dibben MS Excel MVP

On Thu, 26 Jul 2007 18:08:14 GMT, "Banzai" wrote:

I have a macro that runs a pop-up calendar and applies the date selected
from within the calendar to the currently selected cell.

As default I have to run this manually via tools macromacrosrun.

My question is, how do I force this so that as soon as the user clicks on
the cell that particular macro (OpenCalendar) is run and the calendar is
opened for populating the cell that has just been clicked.

If possible i'd also like to limit any user entry for certain cells other
than that populated by the calendar macro.

Thanks in advance


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to run a macro upon a cell click


"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
See how Ron de Bruin does it.

http://www.rondebruin.nl/calendar.htm

Note the "more information" link to download mscal.ocx if needed.


Gord Dibben MS Excel MVP

On Thu, 26 Jul 2007 18:08:14 GMT, "Banzai" wrote:

I have a macro that runs a pop-up calendar and applies the date selected
from within the calendar to the currently selected cell.

As default I have to run this manually via tools macromacrosrun.

My question is, how do I force this so that as soon as the user clicks on
the cell that particular macro (OpenCalendar) is run and the calendar is
opened for populating the cell that has just been clicked.

If possible i'd also like to limit any user entry for certain cells other
than that populated by the calendar macro.

Thanks in advance



Seen that, but I don't (think) it answers my question


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
Click in cell to run macro alistew Excel Discussion (Misc queries) 7 February 20th 07 05:03 PM
Macro on cell click?? PG Oriel[_2_] Excel Programming 6 February 6th 06 10:24 PM
Macro on cell click?? Jim Thomlinson[_5_] Excel Programming 0 February 6th 06 09:33 PM
Macro on cell click?? Gary''s Student Excel Programming 0 February 6th 06 09:29 PM
Run Macro on Cell Click.. CliffHanger9 Excel Programming 0 November 17th 04 07:46 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"