ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   multi tab selection prohibition (https://www.excelbanter.com/excel-programming/286109-multi-tab-selection-prohibition.html)

COM

multi tab selection prohibition
 
I want to prevent users from selecting/highlighting multiple tabs (worksheets) in a workbook, though I want all worksheets to be visible, any ideas?

(This is a repost of yesterday, but didn't get a response that accomplished that desired above)

Chip Pearson

multi tab selection prohibition
 
I don't think there is a way to prohibit the user from selecting
multiple sheets.

"COM" wrote in message
...
I want to prevent users from selecting/highlighting multiple

tabs (worksheets) in a workbook, though I want all worksheets to
be visible, any ideas?

(This is a repost of yesterday, but didn't get a response that

accomplished that desired above)



Tom Ogilvy

multi tab selection prohibition
 
See response to your original post. (for a possible workaround).

--
Regards,
Tom Ogilvy
"COM" wrote in message
...
I want to prevent users from selecting/highlighting multiple tabs

(worksheets) in a workbook, though I want all worksheets to be visible, any
ideas?

(This is a repost of yesterday, but didn't get a response that

accomplished that desired above)



COM

multi tab selection prohibition
 
May be the best solution possible, without going through and undoing each change that was then applied to all selected pages.

See my response on yesterday's thread.

Tom Ogilvy

multi tab selection prohibition
 
The only situation where this would fail is if the user selected multiple
sheets and then immediately made a change to the current activecell on the
activesheet - the event would not be triggered. You could couple this with
a check in the SheetChange event to check Activewindow.SelectedSheets.Count
1 then do an immediate

Application.Undo

Or just use that type of approach in SheetChange.

--
Regards,
Tom Ogilvy

"COM" wrote in message
...
May be the best solution possible, without going through and undoing each

change that was then applied to all selected pages.

See my response on yesterday's thread.




COM

multi tab selection prohibition
 
Came up with a fix... And it deals with all of the possible combinations that we have discussed.

Thank you for the suggestion of Application.Undo. I'm including my resulting code, if anyone would care to accomplish what we've done, and for the length of time that this message will remain on the site.

Of course this "fix" may tick off some users, but let me tell you it is for the better interest of the group than for the one individual that might think to select say all the sheets and potentially overwrite all good data, just to fix one possible mistake on a single sheet. Anyways, the following code works like a charm, thank you each and every one for the assistance. Plagiarize away. :)

Option Explicit

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If ActiveWindow.SelectedSheets.Count 1 Then
ActiveSheet.Select
End If
End Sub

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Excel.Range)
Dim CellData As Variant
Dim CellLoc As Variant


If ActiveWindow.SelectedSheets.Count 1 Then
ActiveSheet.Select
CellLoc = Target.Address()
CellData = Target.Formula

Application.Undo
ActiveSheet.Range(CellLoc).Formula = CellData

End If

End Sub

Private Sub Workbook_SheetSelectionChange( _
ByVal Sh As Object, ByVal Target As Range)
If ActiveWindow.SelectedSheets.Count 1 Then
ActiveSheet.Select
End If
End Sub



All times are GMT +1. The time now is 02:44 PM.

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