Avatar of NewToVBA
NewToVBA
Flag for United States of America asked on

Excel 2007 - Recorded Macro Runs only in Design Mode

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

Avatar of undefined
Last Comment
Rory Archibald

8/22/2022 - Mon
Rory Archibald

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

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

ASKER
"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?

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER CERTIFIED SOLUTION
Rory Archibald

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.