You're using LastWS as if it were an object of Type Worksheet

Sheet1.Range("A3").Value = LastWS.Range("A2").Value

LastWS is a string with a .CodeName in it

I think you wanted to use a string as an index / subscript into the Worksheets collection like this


Sheet1.Range("A3").Value =Worksheets( LastWS).Range("A2").Value


Personally, I think Mac's approach is cleaner since it strictly deals with the objects directly