I have an excel 2010 workbook which has a number of sheets whichhave two stages of protection
1 Fully locked for viewing only Viewing Mode
2 Some unprotected areas for editing data - Edit Mode,selected by password protected button.
I have a button for adding rows whilst in Edit Mode I wantto be able to tell the user that they are trying to insert a row into a ViewingMode sheet and should select the Edit mode.
I have code (Shown below) which can check if the sheet isprotected or not protected, which works, but both the available modes areprotected versions of the sheet. How can I get VBA code to tell if fully orpartially protected?
I tried changing the ProtectContents command to EnableSelection= xlUnlockedCells which would show difference between the two modes, but thatdidnt work.
Any help would be much appreciated
Sub InsertRowProtectionCheck()
If ActiveSheet.ProtectContents = TrueThen
MsgBox"Please choose Edit mode to carry out this function"
Exit Sub
Else
End If
MSG1 =MsgBox("Are you sure you have selected a cell in a blank row? (not in row1)", vbYesNo, "Correct Selection?")
If MSG1 = vbNoThen
Else
CallInsertRowAbove
End If
End Sub
1 Fully locked for viewing only Viewing Mode
2 Some unprotected areas for editing data - Edit Mode,selected by password protected button.
I have a button for adding rows whilst in Edit Mode I wantto be able to tell the user that they are trying to insert a row into a ViewingMode sheet and should select the Edit mode.
I have code (Shown below) which can check if the sheet isprotected or not protected, which works, but both the available modes areprotected versions of the sheet. How can I get VBA code to tell if fully orpartially protected?
I tried changing the ProtectContents command to EnableSelection= xlUnlockedCells which would show difference between the two modes, but thatdidnt work.
Any help would be much appreciated
Sub InsertRowProtectionCheck()
If ActiveSheet.ProtectContents = TrueThen
MsgBox"Please choose Edit mode to carry out this function"
Exit Sub
Else
End If
MSG1 =MsgBox("Are you sure you have selected a cell in a blank row? (not in row1)", vbYesNo, "Correct Selection?")
If MSG1 = vbNoThen
Else
CallInsertRowAbove
End If
End Sub