** Range Copying Madness **
Hi there,
I have a spreadsheet where I need to copy certain values around so
that:
Column D is copied to Column A
Column E is copied to Column C
Column K is copied to Column D
Column L is copied to column E
I have the following script, where tRow is a reference to the last row
containing data. The data starts in row 8, wkDst is a reference to the
Worksheet
tmpRgeText = "D8:D" & tRow
wkDst.Range(tmpRgeText).Copy Destination:=wkDst.Range("A8")
tmpRgeText = "E8:E" & tRow
wkDst.Range(tmpRgeText).Copy Destination:=wkDst.Range("C8")
tmpRgeText = "K8:K" & tRow
wkDst.Range(tmpRgeText).Copy Destination:=wkDst.Range("D8")
tmpRgeText = "L8:L" & tRow
wkDst.Range(tmpRgeText).Copy Destination:=wkDst.Range("E8")
The problem is that columns A and D end up with the contents of column
K and columns C and E end up with the contents of Column L. I guess
this is happening because both range "handles" end up pointing to the
same object in memory.
Can someone suggest a fix for this? I really would prefer solutions
which don't involve doing this at the cell level (which tends to slow
things down unacceptably). Any suggestions would be greatly
appreciated.
Regards,
Ric
|