LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Using code in Excel

Try this
Private Sub Workbook_Open()
On Error GoTo Errhandler
Const sheetName = "Sheet1" 'Replace "Sheet1" with the name of sheet1
Dim sh1 As Worksheet
Set sh1 = Worksheets(sheetName)
sh1.Activate
Exit Sub
Errhandler:
Select Case Err
Case 9:
MsgBox "Missing" & " " _
& "Worksheet Name: " & sheetName
Exit Sub
Case Else:
MsgBox "Error#:" & Err.Number & vbCrLf & Error$
Exit Sub
End Select
End Sub

"Cheyenne" wrote:

Is it possible to write code in excel so that when I open a certain workbook,
it always opens to a specific sheet. I know if you save it on a specific
sheet, it will open there the next time, but I want to be able to save
anywhere in the workbook and have it open to "Sheet1" everytime.
--
Cheyenne

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
How to code it in excel? Eric Excel Worksheet Functions 0 September 26th 06 11:59 AM
Unprotect Code Module in Code Damien Excel Discussion (Misc queries) 2 April 18th 06 03:10 PM
copying vba code to a standard code module 1vagrowr Excel Discussion (Misc queries) 2 November 23rd 05 04:00 PM
VB Code and Excel SMBR Excel Worksheet Functions 2 October 24th 05 10:07 PM


All times are GMT +1. The time now is 08:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"