ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook_Open - Multiple Events not all working (https://www.excelbanter.com/excel-programming/342055-workbook_open-multiple-events-not-all-working.html)

Punsterr

Workbook_Open - Multiple Events not all working
 
I have put the following code in This Workbook. The first routine,
containing the splash screen and code to automatically select cell A1
when opening the workbook, seem to be working fine. The second
process, automatically selecting cell A1 when navigating between
worksheets, doesn't seem to work. Any thoughts?

Private Sub Workbook_Open()

' Shows splash screen upon opening the workbook
Application.OnTime Now + TimeValue "00:00:04"),
"KillSplash"
UFSplash.Show

' Opens workbook to Table of Contents cell A1 upon opening the
workbook.
Sheets("Contents").Select
Range("a1").Select

End Sub

Private Sub Workbook_Sheetactivate(ByVal sh As Object)

' When user navigates to different worksheet, opens to cell A1
If TypeName(sh) = "worksheet" Then Range("a1").Select

End Sub


Thanks!


Patrick Molloy[_2_]

Workbook_Open - Multiple Events not all working
 
If TypeName(Sh) = "Worksheet" Then Range("a1").Select

"Punsterr" wrote:

I have put the following code in This Workbook. The first routine,
containing the splash screen and code to automatically select cell A1
when opening the workbook, seem to be working fine. The second
process, automatically selecting cell A1 when navigating between
worksheets, doesn't seem to work. Any thoughts?

Private Sub Workbook_Open()

' Shows splash screen upon opening the workbook
Application.OnTime Now + TimeValue "00:00:04"),
"KillSplash"
UFSplash.Show

' Opens workbook to Table of Contents cell A1 upon opening the
workbook.
Sheets("Contents").Select
Range("a1").Select

End Sub

Private Sub Workbook_Sheetactivate(ByVal sh As Object)

' When user navigates to different worksheet, opens to cell A1
If TypeName(sh) = "worksheet" Then Range("a1").Select

End Sub


Thanks!



Punsterr

Workbook_Open - Multiple Events not all working
 
Capital "W" worksheet. Nice. I knew it was something silly like that.
Thanks a bunch, Patrick!



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com