Activate specific sheet when open excel

%3CLINGO-SUB%20id%3D%22lingo-sub-255165%22%20slang%3D%22en-US%22%3EActivate%20specific%20sheet%20when%20open%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-255165%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20like%20open%20a%20specific%20worksheet%20whenever%20i%20open%20my%20excel%20irregardless%20where%20is%20my%20last%20save.%3C%2FP%3E%3CP%3EI%20have%20performed%20the%20following%20actions%3A%3C%2FP%3E%3CP%3E1)%20I%20have%20written%20the%20following%20in%20VBA%20project%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPrivate%20Sub%20Workbook_Open()%3CBR%20%2F%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Worksheets(%E2%80%9CSheet1%E2%80%9D).Activate%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Range(%E2%80%9CA1%E2%80%9D).Select%3CBR%20%2F%3E%3CBR%20%2F%3EEnd%20Sub%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E2)%20I%20have%20save%20it%20as%20macro%20enable%20worksheet%20as%20well.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20when%20i%20open%20the%20file%2C%20it%20pop%20out%20run%20time%20error%20and%20unable%20to%20jump%20to%20the%20worksheet%20as%20written%20in%20VBA.%20I%20have%20attached%20the%20excel%20file%20as%20well.%20Please%20advise.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20%26amp%3B%20regards%2C%3C%2FP%3E%3CP%3EKia%20Boon%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-255165%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2623582%22%20slang%3D%22en-US%22%3ERe%3A%20Activate%20specific%20sheet%20when%20open%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2623582%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F125272%22%20target%3D%22_blank%22%3E%40Lorenzo%20Kim%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%2C%20exactly%2C%20is%20the%20problem%20with%20the%20double%20quote%3F%3CBR%20%2F%3EThank%20you.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-260542%22%20slang%3D%22en-US%22%3ERe%3A%20Activate%20specific%20sheet%20when%20open%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-260542%22%20slang%3D%22en-US%22%3EI've%20seen%20others%20made%20that%20kind%20of%20mistakes%20too.%3CBR%20%2F%3Eglad%20to%20help..%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-260540%22%20slang%3D%22en-US%22%3ERe%3A%20Activate%20specific%20sheet%20when%20open%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-260540%22%20slang%3D%22en-US%22%3E%3CP%3EThanks!%20I%20didn't%20know%20that%20mark%20could%20make%20the%20whole%20macro%20unable%20to%20run.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-260029%22%20slang%3D%22en-US%22%3ERe%3A%20Activate%20specific%20sheet%20when%20open%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-260029%22%20slang%3D%22en-US%22%3E%3CP%3Ethe%20problem%20is%20the%20double%20quotation%20mark.%20I%20corrected%20them%20pls%20see%20attached%20file..%3C%2FP%3E%3CP%3EHTH%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2623686%22%20slang%3D%22en-US%22%3ERe%3A%20Activate%20specific%20sheet%20when%20open%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2623686%22%20slang%3D%22en-US%22%3EThere's%20more%20than%20one%20double%20quote%20character.%20When%20you%20copy%2Fpaste%20code%20from%20an%20external%20source%2C%20sometimes%20the%20double%20quotes%20are%20not%20the%20exact%20same%20double%20quote%20that%20vba%20recognizes.%20The%20character%20code%20of%20the%20double%20quote%20in%20the%20OP's%20project%20is%20147%2C%20versus%20the%2034%20vba%20is%20expecting.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fwww.ascii-code.com%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.ascii-code.com%2F%3C%2FA%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

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

the problem is the double quotation mark. I corrected them pls see attached file..

HTH

 

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

I've seen others made that kind of mistakes too.
glad to help..

@Lorenzo Kim 

What, exactly, is the problem with the double quote?
Thank you.

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/