[英]Unlock cells based on both column and row headers?
以防万一有人想知道如何做到这一点。
Sub Lock_Cells()
Dim startCol As Long
startCol = WorksheetFunction.Match("Forecast", Range("1:1"), 0) 'Define in which column Forecast starts
Dim i As Long
For i = 2 To Range("I" & Rows.Count).End(xlUp).Row
If Cells(i, "I").Value = "Actual" Then 'Loop through values in column I
Range(Cells(i, startCol), Cells(i, "U")).Locked = False 'Unlock cells
End If
Next i
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.