insitelastColumn is a string. This is the whole section:
Set insiteWS = Worksheets("InSite Data")
Set progressWS = Worksheets("Progress")
insitelastRow = insiteWS.Range("A65536").End(xlUp).Row
progresslastRow = progressWS.Range("A65536").End(xlUp).Row
insPos = InStr(1,
insiteWS.Range("IV1").End(xlToLeft).Address(ColumnAbsolute:=False), "$",
vbTextCompare)
insitelastColumn =
Left(insiteWS.Range("IV1").End(xlToLeft).Address(ColumnAbsolute:=False),
insPos - 1)
proPos = InStr(1,
progressWS.Range("IV4").End(xlToLeft).Address(ColumnAbsolute:=False), "$",
vbTextCompare)
progresslastColumn =
Left(progressWS.Range("IV4").End(xlToLeft).Address(ColumnAbsolute:=False),
proPos - 1)
Set rngProgresshdr = progressWS.Range("A4:" & progresslastColumn & "4")
Set rngInsitehdr = insiteWS.Range("A2:" & insitelastColumn & insitelastRow)
rngInsitehdr.Select
Selection.Copy
progressWS.Select
ActiveSheet.Range("A5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
it worked fine a couple of times at first, but when I reopened the file and
tried to run it again the error occured and now I am stucked at
rngInsitehdr.Select