How do I stop a macro from running within a macro?

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

Guest

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

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