Link to home
Create AccountLog in
Avatar of NewToVBA
NewToVBAFlag 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
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

What is the macro, and what is the issue if not in design mode?
Avatar of 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
"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?

ASKER CERTIFIED SOLUTION
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account