Excel 2007 - Recorded Macro Runs only in Design Mode

NewToVBA
NewToVBA used Ask the Experts™
on
Helo Experts - I recorded a macro with sheet formatting commands and it would not run unless I activated the design mode. Any idea what's going on?

Cheers, V
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2011
Top Expert 2011

Commented:
What is the macro, and what is the issue if not in design mode?

Author

Commented:
Sorry, I was not clear enough. The macro is a simple code with formatting cells, e.g., font, alignment, borders. But, I found what the problem is. The macro works fine when I disable the code
in ThisWorkbook "Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)" .
So, if this is my remedy how can I control it from the formatting macro, ie., disable at the start and enable back when done with formatting?
Cheers, V

Author

Commented:
"application.enableevents = false" put in the first line and "application.enableevents = true" in last
appears to be working. Is there a side effect of it I should consider?

Most Valuable Expert 2011
Top Expert 2011
Commented:
Not really but you need an error handler to ensure that it is set back to True no matter what.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial