Forum Discussion
Sumit_Bhokare
Oct 09, 2023Brass Contributor
How to Hide and protect few columns of worksheet
Hello All, Attached is sample worksheet on which currently I'm working. I need to Hide column F, G and H and protect those only with password so that no one can unhide it without password. I tried...
- Oct 11, 2023
Create a command button in rows 1 / 2 and assign the following macro to it:
Sub DeleteRows() If Intersect(Range("A1:A2").EntireRow, Selection) Is Nothing Then ActiveSheet.Unprotect Password:="Hello" Selection.EntireRow.Delete ActiveSheet.Protect Password:="Hello" Else MsgBox "You are not allowed to delete rows 1 and/or 2!", vbCritical End If End SubSee the attached version.