Select method of Range class failed error message
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(Column Absolute:=False), "$",
vbTextCompare)
insitelastColumn =
Left(insiteWS.Range("IV1").End(xlToLeft).Address(C olumnAbsolute:=False),
insPos - 1)
proPos = InStr(1,
progressWS.Range("IV4").End(xlToLeft).Address(Colu mnAbsolute:=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
"Jacob Skaria" wrote:
Hope inSitLastColumn and insitelastrow are dimensioned as Long..
Set insiteWS = Worksheets("InSite Data")
Set rngInsitehdr = insiteWS.Range("A2", Cells(insitelastColumn,
insitelastRow))
rngInsitehdr.Select
--
If this post helps click Yes
---------------
Jacob Skaria
"Ayo" wrote:
I have this section of code but I get the above error message whenever I get
to the last line:
rngInsitehdr.Select
I can't figure it out. Any ideas?
Thanks.
Set insiteWS = Worksheets("InSite Data")
Set rngInsitehdr = insiteWS.Range("A2:" & insitelastColumn & insitelastRow)
rngInsitehdr.Select
|