D
davegb
I'm getting a "method range of object worksheet failed" error at the
line marked:
Set rStart = Range("B4")
lRow = rStart.End(xlDown).Row - 1
Set rCty = Range(rStart, Cells(lRow, "B"))
Call ColUnHideAll
Set wkshtSource = ActiveSheet
Set wkshtNew = Workbooks.Add.Sheets("sheet1")
rCty.Copy Destination:= _
wkshtNew.Range("A2")
Set rTopCell = wkshtSource.Range("3:3").Find("top", LookIn:=xlValues,
lookat:=xlPart)
If Not rTopCell Is Nothing Then
lColTop = rTopCell.Column
lStartRow = rTopCell.Row + 1
End If
Set rCtySts = wkshtSource.Range(Cells(lStartRow, lColTop), Cells(lRow,
lColTop + 1))<------ERROR
rCtySts.Copy Destination:=wkshtNew.Range("B2")
End Sub
A couple of lines above, method range of the same worksheet worked
fine. So what's wrong with having another range of the same worksheet?
line marked:
Set rStart = Range("B4")
lRow = rStart.End(xlDown).Row - 1
Set rCty = Range(rStart, Cells(lRow, "B"))
Call ColUnHideAll
Set wkshtSource = ActiveSheet
Set wkshtNew = Workbooks.Add.Sheets("sheet1")
rCty.Copy Destination:= _
wkshtNew.Range("A2")
Set rTopCell = wkshtSource.Range("3:3").Find("top", LookIn:=xlValues,
lookat:=xlPart)
If Not rTopCell Is Nothing Then
lColTop = rTopCell.Column
lStartRow = rTopCell.Row + 1
End If
Set rCtySts = wkshtSource.Range(Cells(lStartRow, lColTop), Cells(lRow,
lColTop + 1))<------ERROR
rCtySts.Copy Destination:=wkshtNew.Range("B2")
End Sub
A couple of lines above, method range of the same worksheet worked
fine. So what's wrong with having another range of the same worksheet?