Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Excel Setting Focus on specific tab 1

Status
Not open for further replies.

dprayner

Programmer
Oct 14, 2002
140
US
Hi people.

I have a multi-tab spreadsheet and some tabs are to be hidden when the Workbook opens. That works fine, but there are two tabs I want to display, but the "main" tab needs to be selected when the Workbook opens. I have tried several methods like:

Worksheets("Sheet1").Activate
Worksheets("Sheet1").Select

without any luck. I usually get a subscript range 9 error.

Also once the spreadsheet is selected, I would like to select a specific range. Any suggestions? DAVE
 
Seems like a silly question, but do you have a sheet named Sheet1?

You'll get that error if you identify a sheet name that doesn't exist.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Hi AH. I have a Sheet1, but the tab name is General. DAVE
 
Then this will work:

[COLOR=blue white]Worksheets("General").Activate[/color]

You need to use the sheet tab name that is visible when viewing the spreadsheet.

You could also reference the first tab as

[COLOR=blue white]Worksheets(1).Activate[/color]

This would select the first tab, regardless of its name.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top