Hi,
I modified little bit the procedure in order to set the current layer to "0" because in your drawing I saw sometime the current layer has been settled from those included in excel file to be turn off or on.
So here attached your excel file with Module 10 modified with the following parts:
Global AcadDoc As Object
Sub Cad_Transfer()
Dim AcadApp As Object
'Dim AcadDoc As Object ' MOVED AS GLOBAL VARIABLE DECLARATION
...
MyAdd = Selection.Address
Range("B2").Select 'After retriving last cell in the excel file, selection will be settled to top list cell.
'Check if layer shall be on or off
SetToLayer0 ' Added routine for setting layer "0" as current before settining ON OFF the layers listed in Ecel file.
....
'NEW ROUTINE
Sub SetToLayer0()
Dim MyLayer As AcadLayers
Set MyLayer = AcadDoc.Layers
i = 0
For Each CurrentLayer In MyLayer
If CurrentLayer.Name = "0" And CurrentLayer.Name <> AcadDoc.ActiveLayer.Name Then
AcadDoc.ActiveLayer = AcadDoc.Layers.Item(i)
End If
i = i + 1
Next
End Sub
However again attached your excel file, please check module 10 VBA.
Command button on excel worksheet has been fixed pointing MODULE 10 procedure Cad_Transfer()
A final MsgBox at the end of layer setting ON OFF procedure could be added, in order to have a check of end of procedure.
Actually it's not provided, you can add to yourself.
Regards
Copy of Copy of Copy of ACADTEST - Copy.xlsm