2016-12-28 82 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

相关问题