Forum Discussion
Activate specific sheet when open excel
Hi all,
I would like open a specific worksheet whenever i open my excel irregardless where is my last save.
I have performed the following actions:
1) I have written the following in VBA project:
Private Sub Workbook_Open()
Worksheets(“Sheet1”).Activate
Range(“A1”).Select
End Sub
2) I have save it as macro enable worksheet as well.
However, when i open the file, it pop out run time error and unable to jump to the worksheet as written in VBA. I have attached the excel file as well. Please advise.
Thanks & regards,
Kia Boon
5 Replies
- Lorenzo KimBronze Contributor
the problem is the double quotation mark. I corrected them pls see attached file..
HTH
- Michael PepperCopper Contributor
What, exactly, is the problem with the double quote?
Thank you.- JMB17Bronze ContributorThere's more than one double quote character. When you copy/paste code from an external source, sometimes the double quotes are not the exact same double quote that vba recognizes. The character code of the double quote in the OP's project is 147, versus the 34 vba is expecting.
https://www.ascii-code.com/
- Kia Boon GohCopper Contributor
Thanks! I didn't know that mark could make the whole macro unable to run.
- Lorenzo KimBronze ContributorI've seen others made that kind of mistakes too.
glad to help..