Thank you everyone who replied! The code is good, but there was non-breaking spaces or invisible characters that caused the compile error for me. After removing those, it ran successfully! So excited for my first VB! Thanks again!
First time posting and first time using VB in Excel. I am trying to write a VB program to format all the tabs in my Excel file to make sure every tab has the same font and size. Below is my code. When I run F5 to run, it gave me "Compile error: Syntax error". Please help. Thanks.
Below is what I did.
Press Alt + F11 to open the VBA Editor in Excel.
Go to Insert > Module.
I copied the below code into the Module window. Then I pressed F5 to run. I received "Compile error: Syntax error".
![]()
Please Login or Register to view this content.
Bookmarks