Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

prevent selection of multiple sheets

18 views
Skip to first unread message

Amy

unread,
Dec 7, 2001, 8:44:21 AM12/7/01
to
Hello,

In my workbook I want to prevent selection of multiple
sheets (by others), so that any changes will only affect
the active sheet.
I have tried to find a property to set or an event to
respond to; no luck.

Anyone any suggestions?
Thanks.

Bernie Deitrick

unread,
Dec 7, 2001, 11:33:25 AM12/7/01
to
Amy,

Try putting the code below into the ThisWorkbook object of your project.

HTH,
Bernie

Dim myFlag As Boolean

Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Range)
Application.EnableEvents = False
If ActiveWorkbook.Windows(1).SelectedSheets.Count > 1 Then
Sh.Select
If myFlag = False Then
MsgBox "You have multiple sheets selected. Bad user."
Application.Undo
myFlag = True
End If
End If
Application.EnableEvents = True
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)
myFlag = False
End Sub

0 new messages