VBA: Simple Table Copy & Paste

ExcelJacob

New Member
Joined
Jul 23, 2015
Messages
5
Using Excel 2013 on current Windows: I need to copy an entire table ("Table1") and paste it to a range starting in "I2". I've tried ActiveSheet.ListObjects("Table1").Range.Copy ("I2"). It doesn't work. I can't paste the values only because I need to use and alter the formulas later. I've also tried other iterations of range.copy to no avail. I'm getting error message "Copy method of Range class failed."

Thank you for your help.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
You haven't qualified ("I2") in anyway

The correct line would be:

Code:
[COLOR=#333333] ActiveSheet.ListObjects("Table1").Range.Copy [/COLOR][COLOR=#333333]ActiveSheet.Range[/COLOR][COLOR=#333333]("I2")[/COLOR]
 
Upvote 0
Try this:

Code:
ActiveSheet.Range("Table1").Copy Destination:=ActiveSheet.Range("I2")
 
Upvote 0
Thank you guys! That worked. My next problem comes from the Macro recorder. I get "Subscript out of range" error message from


'ActiveSheet.ListObjects("Table2").TableStyle = "TableStyleMedium6"


I'm just trying to make the two tables different colors really. In the end, I need a black table, blue table, orange table, and yellow table to represent different vendors.
 
Upvote 0
Do I need to post this second question in a new thread?

Thank you guys! That worked. My next problem comes from the Macro recorder. I get "Subscript out of range" error message from


'ActiveSheet.ListObjects("Table2").TableStyle = "TableStyleMedium6"


I'm just trying to make the two tables different colors really. In the end, I need a black table, blue table, orange table, and yellow table to represent different vendors.
 
Upvote 0

Forum statistics

Threads
1,216,100
Messages
6,128,825
Members
449,470
Latest member
Subhash Chand

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