I have the following Calendar Macro. I want this to pop up when cell A5 is active vs assigning a Macro Button. How do I do? Thanks
![]()
Please Login or Register to view this content.
I have the following Calendar Macro. I want this to pop up when cell A5 is active vs assigning a Macro Button. How do I do? Thanks
![]()
Please Login or Register to view this content.
Last edited by VBA Noob; 09-19-2007 at 11:12 AM.
Hi Andrew,
You can use the following code in the VBA module of the worksheet which contains the cell from which you want to trigger the routine:
The check of "Target.Cells.Count = 1" just ensures that the routine won't be triggered if the user selects a multi-cell range which includes cell A5.![]()
Please Login or Register to view this content.
Hope this helps - please let me know how you get on.
Best regards,
Greg M
I am confused... What is the full code to show calendar pop up when cell "A5" is selected?
Thanks
Hi again,
Excel triggers the "Worksheet_SelectionChange" event whenever a cell or range of cells is selected.
The "If" statement first checks that only a single cell is selected, and then checks that there is a valid intersection between the selected cell ("Target") and cell A5 ("strCalendarCell") - in this case, a "valid intersection" means that the selected cell and cell A5 are one and the same.
When the "If" statement returns a value of TRUE, the "frmCalendar.Show" statement is executed.
Regards,
Greg M
Have you tried the code?Originally Posted by andrew8008
Hope that helps.
RoyUK
--------
For Excel Tips & Solutions, free examples and tutorials why not check out my web site
Free DataBaseForm example
I tried the code and it doesn't seem to work. Please check attached file.
I would also like to activate when "B5" is active along with "A5".
Thanks for all your help!!!
Hi again,
You entered the code in a standard VBA module - you must enter it in the VBA module for the WORKSHEET. Right-click on the worksheet tab & select "View Code" - this will display the VBA module for the worksheet.
To extend the "activation range" use:
Regards,![]()
Please Login or Register to view this content.
Greg M
It isn't working... Attached is actual file. I need it to activate in cell C7 & G7.
I get an error no matter what cell I click on. Thanks
It would work if you had a frmCalendar!
In attached file i added a form and a calendar control in the form (to select a date use double click).
I hope it's what you need.
Regards,
Antonio
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks