View Full Version : Solved: Sheet tab change event
BENSON
03-23-2008, 12:28 AM
I have a workbook that has 4 worksheets,is it possible that when a user clicks on another worksheet that a message box appears asking the user if certain data has been checked ,before moving to the next sheet.ie: if sheet 1 is the active sheet and I click on sheet tab 2 the message box would appear prior to opening sheet 2 with either a "YES "or "NO" option.If the "YES" option is selected than sheet 2 would open
THANKS.
Bob Phillips
03-23-2008, 02:33 AM
Look at the Worksheet_Activate event.
chat163
03-23-2008, 07:01 AM
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim msg
msg = MsgBox("Do you want to open " & Sh.Name, vbYesNo, "Remind")
If msg = vbYes Then
'fill
Else
'fill
End If
End Sub
mdmackillop
03-23-2008, 09:49 AM
Tests for data in A1
Option Explicit
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Dim msg
Application.EnableEvents = False
If Sh.Range("A1") = "" Then
msg = MsgBox(Sh.Name & " A1 not completed. Exit sheet?", vbYesNo + vbQuestion)
If msg = vbNo Then
Sh.Select
End If
End If
Application.EnableEvents = True
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.