Hi,
How to un-protect multiple cells in Excel worksheet with coding.
I have a worksheet.
I need to protect entire worksheet apart from few cells.
I tried various solutions from Google but somehow it is not working for me.
For example, I want to keep cell A1, B5, C10, D15, E20 unprotected.
And rest of the worksheet should be protected.
How do I do this
Can anyone please help me in this.
I tried various options for below code but not successful.
How to un-protect multiple cells in Excel worksheet with coding.
I have a worksheet.
I need to protect entire worksheet apart from few cells.
I tried various solutions from Google but somehow it is not working for me.
For example, I want to keep cell A1, B5, C10, D15, E20 unprotected.
And rest of the worksheet should be protected.
How do I do this
Can anyone please help me in this.
I tried various options for below code but not successful.
Code:
Sub Protect_My_Range()
Dim TempBook As Workbook
Dim TempSht As Worksheet
Dim TempRng As Range
Dim TRange As Range
Set TempBook = ActiveWorkbook
Set TempSht = TempBook.ActiveSheet
TempSht.Range("F7").Locked = False
TempSht.Range("N7").Locked = False
TempSht.Protect "temp"
End Sub
Last edited: