2016-12-28 78 views

回答

2

因爲,空白格式-4142而不是0

改成這樣:

If cell.Interior.ColorIndex = -4142 Then cell.Locked = False 

可靠的方法:

Sub macunlock() 
    Dim rng1 As Range 
    Set rng1 = Range("A1:C1") 
    For Each cell In rng1 
     If cell.Interior.ColorIndex = XlColorIndex.xlColorIndexNone Then 
      cell.Locked = False 
     End If 
    Next cell 
End Sub 
+1

謝謝!那樣做了。將接受在6分鐘 –

+0

很高興它的工作! – cyboashu

相關問題