View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default ** Range Copying Madness **

Ric,

Testing using your code doesn't do what you suggest for me, apart from
leaving K&L populated, it seems to work fine.

You don't repeat the action by any chance, as that would cause it to happen.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"ric_deez" wrote in message
oups.com...
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