Excel/Unprotecting dynamic rows in a protected worksheet
Need your help in doing the below task using Formula/Macro.
I would like to unprotect the dynamic rows where it contains the word "Production Plan (Units) - Revised" in column B.
As per this example I would like to unprotect the cells C7:H7, C10:H10, C15:H15. I want to unprotect the whole row after the cell contains particular text (i.e. "Production Plan (Units) - Revised" in this case).
Please note that range will be dynamic. Please let me know if you have any question.
You could use this code behind the worksheet. Right-click the worksheet's tab and choose "View code". Then paste in this macro:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim oCell As Range
If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub
If Target.Cells.Count <> 1 Then Exit Sub
For Each oCell In Intersect(Me.UsedRange, Me.Range("B:B"))
If oCell.Value = "Production Plan (Units) - Revised" Then
Me.Range(oCell.Offset(, 1), Me.Cells(oCell.Row, Me.Columns.Count)).Locked = False
Me.Range(oCell.Offset(, 1), Me.Cells(oCell.Row, Me.Columns.Count)).Locked = True
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here