I have code that scans for locked cells.. only problem is it says they are ALL locked.
I have range(A1:C13) as not locked.. and the worksheet is protected.
Now I can change values in that range but no where else...
but code returns ALL cells as locked??
whats wrong with this:
VB Code:
Sub ScanCell() Dim WB As Workbook Dim WS As Worksheet Dim tWS As Worksheet Set WB = ActiveWorkbook Dim sRange_Col As String Dim sRange_Row As Long Dim tmp As String Dim tmpR() As String Dim lRow As Integer Dim lCol As Integer lRow = 2 lCol = 64 WB.Worksheets.Add Sheets(1) Set tWS = ActiveSheet tWS.Name = "LOCKED CELLS" For Each WS In WB.Worksheets If WS.Name <> tWS.Name Then tWS.Range("A1") = "LOCKED CELLS" lRow = 2 lCol = lCol + 1 tmp = Replace(WS.UsedRange.Address, "$A$1:", "") tmpR = Split(tmp, "$") sRange_Col = tmpR(1) sRange_Row = tmpR(2) For col = 65 To Asc(sRange_Col) For Row = 1 To sRange_Row If Range(Chr(col) & Row).Locked Then tWS.Range(Chr(lCol) & lRow) = WS.Name & "!" & Chr(col) & Row lRow = lRow + 1 End If Next Next End If Next End Sub
Thanks!!




Reply With Quote