ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VISUAL BASIC CODE (https://www.excelbanter.com/excel-programming/361774-visual-basic-code.html)

Josephine Ng

VISUAL BASIC CODE
 
Please advise what visual basic code I need to use to always open my file
showing the first worksheet even though I save the file at 2nd or 3rd
worksheets.

NickHK

VISUAL BASIC CODE
 
Josephine,
Assuming you are using something like:
Set MyWB=Workbooks.Open(PathAndFilename)
add a line:
MyWB.Worksheets(1).Activate
......

NickHK

"Josephine Ng" <Josephine wrote in message
...
Please advise what visual basic code I need to use to always open my file
showing the first worksheet even though I save the file at 2nd or 3rd
worksheets.




JMB

VISUAL BASIC CODE
 
You could also try an event handler. It goes in the ThisWorkBook module.

Private Sub Workbook_Open()
Worksheets(1).Activate
End Sub

"Josephine Ng" wrote:

Please advise what visual basic code I need to use to always open my file
showing the first worksheet even though I save the file at 2nd or 3rd
worksheets.



All times are GMT +1. The time now is 02:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com