I
IanC
I have some code which is confusing me. The code copies some named ranges
from Lookup to specific locations on Checklist.
This code works fine:
With Worksheets("Checklist")
[Lookup!InstruSoftware].Copy .Range("I2")
[Lookup!TubeCount].Copy .Range("U3")
[Lookup!Alpha_kV].Copy .Range("A6")
[Lookup!Alpha_AEC].Copy .Range("A18")
[Lookup!Alpha_Errors].Copy (.Range("O6")) 'xxxx
[Lookup!AlphaAlignment].Copy .Range("Y6")
[Lookup!Alpha_Mechanical].Copy (.Range("Y15")) 'xxxx
[Lookup!Alpha_Electrical].Copy (.Range("Y30")) 'xxxx
[Lookup!Alpha_Earthing].Copy (.Range("O28")) 'xxxx
End With
If I change Worksheets("Checklist") to Me, I get an error for each of the
marked lines. The error is "Run-time error '1004': Copy method of Range
class failed".
The destination sheet is unprotected and there are no merged cells in the
destination ranges.
Can anyone explain why there is this difference between using Me and the
sheet name?
from Lookup to specific locations on Checklist.
This code works fine:
With Worksheets("Checklist")
[Lookup!InstruSoftware].Copy .Range("I2")
[Lookup!TubeCount].Copy .Range("U3")
[Lookup!Alpha_kV].Copy .Range("A6")
[Lookup!Alpha_AEC].Copy .Range("A18")
[Lookup!Alpha_Errors].Copy (.Range("O6")) 'xxxx
[Lookup!AlphaAlignment].Copy .Range("Y6")
[Lookup!Alpha_Mechanical].Copy (.Range("Y15")) 'xxxx
[Lookup!Alpha_Electrical].Copy (.Range("Y30")) 'xxxx
[Lookup!Alpha_Earthing].Copy (.Range("O28")) 'xxxx
End With
If I change Worksheets("Checklist") to Me, I get an error for each of the
marked lines. The error is "Run-time error '1004': Copy method of Range
class failed".
The destination sheet is unprotected and there are no merged cells in the
destination ranges.
Can anyone explain why there is this difference between using Me and the
sheet name?