ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I stop a macro from running within a macro? (https://www.excelbanter.com/excel-programming/332858-how-do-i-stop-macro-running-within-macro.html)

JohnUK

How do I stop a macro from running within a macro?
 
Hi, I have got everything set up so that when a cell is selected, it would
bring up the date calendar in order to insert the date. The problem I have is
when I want to clear down all the data that has been entered onto the
worksheet including the cells that contain the dates (using another macro) it
stops on the cells and brings up the calendars, whereas this time I dont
want them to.
Is there someway I can enter something into my clear down code that would
temporarily stop the calendars from popping up?
Many thanks in advance
John


Norman Jones

How do I stop a macro from running within a macro?
 
Hi JohnUK,

Try rewritng your code to avoid selectiions.

It is rarely necessary to make selections.

If, however, selection *is* necessary, then you could temporarily disable
the event code that displays the calendar control by using using the
EnableEvents property in the data clearing sub:

Sub ClearData

On Error GoTo CleanUp 'To reset Events in case of error!
Application.EnableEvents = False

'Your clearing code

CleanUp:
Application.EnableEvents = True

End sub

---
Regards,
Norman



"JohnUK" wrote in message
...
Hi, I have got everything set up so that when a cell is selected, it would
bring up the date calendar in order to insert the date. The problem I have
is
when I want to clear down all the data that has been entered onto the
worksheet including the cells that contain the dates (using another macro)
it
stops on the cells and brings up the calendars, whereas this time I don't
want them to.
Is there someway I can enter something into my clear down code that would
temporarily stop the calendars from popping up?
Many thanks in advance
John





All times are GMT +1. The time now is 09:45 PM.

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