Open workbook at specific worksheet

  • Thread starter Thread starter Adam Price
  • Start date Start date
A

Adam Price

Is it possible to specify a particular worksheet for a workbook to ope
at?

Eg. Open file 'Employee.xls' at worksheet titled 'Dave'

I can't find any relevant switches to specify on startup, but as a sid
note, info on opening position must be recorded within the spreadshee
file as a workbook will always open at the last sheet you were using.

Any help greatly appreciated.

Cheers,
Ada
 
If you save the file with Dave the active worksheet, it'll reopen that way, too.

Or you could have a macro do the work for you:

Option Explicit
Sub auto_open()
Dim wks As Worksheet

Set wks = Nothing
On Error Resume Next
Set wks = ThisWorkbook.Worksheets("Dave")
On Error GoTo 0

If wks Is Nothing Then
'dave doesn't exist
'what should happen?
Else
Application.Goto wks.Range("a1"), scroll:=True
'or
'wks.select
End If

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

ps. That is a wonderful name for a worksheet! More people should use it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top