Sorry my bad
Try this one instead
(not tesded though because of
I can't rich Acad at the moment)
Option Explicit
Sub ChangeLayersColor()
On Error Resume Next
Dim oLayer As AcadLayer, itmLay As Variant, i As Long
Dim lockedColl As New Collection
With ThisDrawing
For Each oLayer In .Layers
'unlock layer if this was locked
If oLayer.Lock = True Then
oLayer.Lock = False
' add layer name to collection with key that allow to add just iniques only
i = i + 1
lockedColl.Add oLayer.Name, CStr(i)
End If
oLayer.color = acWhite
Next
.Regen acAllViewports
For Each itmLay In lockedColl
'then turn back to lock all the unlocked layers
.Layers.item(itmLay).Lock = True
Next
End With
End Sub
~'J'~