PDA

Click to See Complete Forum and Search --> : [RESOLVED] sheet opening


pandey_om
Feb 14th, 2006, 11:51 AM
hi expert :blush:
i have a workbook PI-Template ,in which there are 3 sheets like sheet1,sheet2,sheet3
i coded
workbook_open()
worksheets("sheet1").activate
end

when i open the workbook sheet1 ativated on screen
the problem is that when i copy the same workbook with different name in another folder and when i open workbook ,sheet2 activated,
How i solve this problem :)

Static
Feb 14th, 2006, 12:00 PM
worksheets(1).activate
will always select the first sheet no matter what the sheet name is

pandey_om
Feb 14th, 2006, 12:05 PM
i copied the workbook with different name, not changing the worksheet name

RobDog888
Feb 14th, 2006, 12:09 PM
Can you post more of your code?

cssriraman
Feb 14th, 2006, 12:19 PM
Hi,

The Workbook_Open procedure MUST reside in the private module of the Workbook Object (ThisWorkbook).

Open the VBE double click the Module called ThisWorkbook, seen in the Project Explorer (View>Project Explorer (Ctrl+R)).
Private Sub Workbook_Open()
Worksheets("sheet1").Activate
End Sub
The sheet name should match with the name which you gave in your code. if not you will get an error saying: "Runtime error '9'; Subscript out of range".

pandey_om
Feb 17th, 2006, 05:44 AM
thanks experts my problem solved