VBA to apply different passwords to allow grouping and ungrouping of selected cells

phillip87

Board Regular
Joined
Jan 28, 2019
Messages
69
I have a locked worksheet with the below VBA to allow people to group/ungroup while not being able to change the data. However I now want to take this a step further and password protect each group so departments can only view their own data within the protected sheet.

The data is grouped vertically and horizontally.
11 groups of 16 rows down the side, A4-A18, A19-A37 etc.
5 groups of of 11 columns at the top, F-P, Q-AA, AB-AL etc.



Private Sub Workbook_Open( )
With Sheet1
.Protect Password:="Secret", UserInterfaceOnly:=True
.EnableOutlining = True
End With
End Sub
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
I've done similar. You're going to have to control the grouping through macros after the user enters a password. I would store the passwords in VBA and password protect the VBA project. Each password entered is tested and then the groups are selected to be displayed. I would have a macro run that hides all the groups when the last user closes the workbook.
 
Upvote 0
I've done similar. You're going to have to control the grouping through macros after the user enters a password. I would store the passwords in VBA and password protect the VBA project. Each password entered is tested and then the groups are selected to be displayed. I would have a macro run that hides all the groups when the last user closes the workbook.
That's what I was thinking but I am not the best with formatting VBA though I can read and understand it, I have been looking for some VBA code today but have not been able to find any really
 
Upvote 0
This is a lot ow work. Some hand holding once you get some code and I can't work without your workbook or an example.

Kinda late tonight
 
Upvote 0

Forum statistics

Threads
1,215,647
Messages
6,126,005
Members
449,279
Latest member
Faraz5023

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top