Copy Destination Problem

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,665
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
There is likely an obvious error I can't see ...

Code:
With ws_dump
     .Range("A2:A" & f_rowcnt).Copy Destination:=.Range("AA2")
End With

I am simply trying to copy the cell contents, A2:A4, from worksheet ws_dump to cell AA2 in ws_dump.
Why are the 3 cells being copied to AA1:AA3?
 
If you don't put the full code, we'll just guess... 🧙‍♂️

Rich (BB code):
.Range("A2:A" & f_rowcnt).Copy Destination:=.Range("AA2")
How are you filling the variable f_rowcnt?


I am simply trying to copy the cell contents, A2:A4
If you only want to copy A2 to A4, then it should be:
Rich (BB code):
.Range("A2:A4").Copy Destination:=.Range("AA2")

;)
 
Upvote 0
Hi Dante, thanks for your reply. The range to be copied is dynamic, I used A2:A4 only as an example. The range being copied is defined by A2:A & f_rowcnt where f_rowcnt was previously calculated
Code:
f_rowcnt = WorksheetFunction.CountA(ws_dump.Columns(1))

This value is being calculated properly.
 
Upvote 0
I think I got it solved. There may have been values in AA1 prior to pasting which made it appear the values were being placed at AA1.
All good after a dded a line to clear that column.
 
Upvote 0

Forum statistics

Threads
1,226,871
Messages
6,193,448
Members
453,800
Latest member
dmwass57

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top