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

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
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,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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