Shawn Wallack
Member
Members
Forum Posts: 77
Member Since:
December 7, 2021
December 7, 2021
Offline
Hi -
I have a worksheet with a pivot table that starts in cell W1. It's important that the table does not move to a different column or row, because the specific cell address "W2" is referenced in multiple formulas. The table is located in hidden cells.
I need to prevent the user from inserting or deleting rows or columns through any mechanism. Here is what I have so far, but I think I must be missing something my more "creative" users may attempt.
Also, I can't seem to disable the "Clear Contents" option.
Any thoughts?
Sub AllowInsertDeleteRowCols(bSwitch As Boolean) Dim ctrl As CommandBarControl ' Row delete For Each ctrl In Application.CommandBars.FindControls(ID:=293) ctrl.Enabled = bSwitch Next ctrl ' Column delete For Each ctrl In Application.CommandBars.FindControls(ID:=294) ctrl.Enabled = bSwitch Next ctrl ' Row and column insert For Each ctrl In Application.CommandBars.FindControls(ID:=3183) ctrl.Enabled = bSwitch Next ctrl ' Cell delete For Each ctrl In Application.CommandBars.FindControls(ID:=292) ctrl.Enabled = bSwitch Next ctrl ' Cell insert For Each ctrl In Application.CommandBars.FindControls(ID:=3181) ctrl.Enabled = bSwitch Next ctrl ' Clear contents For Each ctrl In Application.CommandBars.FindControls(ID:=873) ctrl.Enabled = bSwitch Next ctrl If bSwitch Then Application.OnKey "{DELETE}" Else Application.OnKey "{DELETE}", "" End If End Sub Sub DisableActions Call AllowInsertDeleteRowCols(False) End Sub Sub EnableActions Call AllowInsertDeleteRowCols(True) End Sub
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online:
Guest(s) 7
Currently Browsing this Page:
1 Guest(s)
1 Guest(s)
Top Posters:
Catalin Bombea: 1943
SunnyKow: 1432
Anders Sehlstedt: 943
Purfleet: 415
Hans Hallebeek: 369
Frans Visser: 349
David_Ng: 315
lea cohen: 248
Jessica Stewart: 219
A.Maurizio: 216
Newest Members:
aly soliman
Corlie Myburgh
Mishay Felton
Mike Clemens
Stuart Nicklin
Victor Morales
Cara Di Marzio
Les Stuart
- Muangmontree
Ross Craig
Forum Stats:
Groups: 3
Forums: 25
Topics: 7121
Posts: 31241
Member Stats:
Guest Posters: 50
Members: 34595
Moderators: 2
Admins: 3
Administrators: Mynda Treacy, Philip Treacy, Jessica
Moderators: Velouria, Riny van Eekelen
© Simple:Press —