Thread
:
Do 3 Tasks on Opening File Q
View Single Post
#
2
Posted to microsoft.public.excel.programming
Tushar Mehta
external usenet poster
Posts: 1,071
Do 3 Tasks on Opening File Q
You declare the variable sh three times!
Also, you declare the variable as sh but what do you use in the first loop?
--
Regards,
Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
In article om,
says...
I am trying to do 3 things when I open up a file
1) Unprotect all worksheets in the file
2) Go to A1 in all sheets
3) Finally activate C6 in the sheet Current week
I had 2 & 3 above working and I tried adding 1 above, but am hitting
debug so I guess I have some syntax wrong
Private Sub Workbook_Open()
Application.ScreenUpdating = False
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
ws.unProtect Password:="1234"
Next Dim sh As Worksheet
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
sh.Select
Application.GoTo Reference:=sh.Range("a1"), Scroll:=True
Next sh
ThisWorkbook.Sheets("Current Week").Select
Application.ScreenUpdating = True
ActiveWindow.Zoom = 75
Range("C6").Select
End Sub
Reply With Quote
Tushar Mehta
View Public Profile
Find all posts by Tushar Mehta