Forum

Copying multi-colum...
 
Notifications
Clear all

Copying multi-column excel table data

5 Posts
2 Users
0 Reactions
71 Views
(@sal-veltri)
Posts: 27
Eminent Member
Topic starter
 

I have two tables, tblEnlisted (5 columns) and tblDay1 (1st row only - no data). I tried variations of code to copy columns 3, 4, 5 from tblEnlisted to column 1, 2, 3 of tblDay1. The last code I tried;

Sheet2.Range("tblEnlisted[[Name],[Sex],[Index]]").Copy Destination:=Sheet7.Range("tblDay1[Column1]")

gives an error - Method 'Range' of worksheet'_Worksheet' failed
Where did I go wrong?

 
Posted : 04/08/2019 7:06 pm
(@catalinb)
Posts: 1937
Member Admin
 

If source columns are consecutive, try:

Sheet2.Range("tblEnlisted[[Name]:[Index]]").Copy Destination:=Sheet7.Range("tblDay1[Column1]")

 
Posted : 06/08/2019 2:30 am
(@sal-veltri)
Posts: 27
Eminent Member
Topic starter
 

Thank you for your reply. Still get same result.

 
Posted : 06/08/2019 4:54 pm
(@catalinb)
Posts: 1937
Member Admin
 

Then you should upload a sample file so we can see what's wrong, works on my side.

 
Posted : 06/08/2019 11:58 pm
(@sal-veltri)
Posts: 27
Eminent Member
Topic starter
 

Hi Catalin,

I have resolved the issue with the following.

Sheet2.Range("tblEnlisted[[Name]:[Index]]").Select
Selection.Copy
Sheet7.Select
Sheet7.Range(rng).Select
ActiveSheet.Paste

Thank you for your time and concern.

Sal

 
Posted : 07/08/2019 6:17 pm
Share: