Forum Discussion

Kia Boon Goh's avatar
Kia Boon Goh
Copper Contributor
Sep 19, 2018

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

      • JMB17's avatar
        JMB17
        Bronze Contributor
        There'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 Goh's avatar
      Kia Boon Goh
      Copper Contributor

      Thanks! I didn't know that mark could make the whole macro unable to run.

      • Lorenzo Kim's avatar
        Lorenzo Kim
        Bronze Contributor
        I've seen others made that kind of mistakes too.
        glad to help..

Resources