thomas899

New Member
Joined
Jan 23, 2019
Messages
2
Hello,

Let me start by saying that I am very new to VBA coding, so I'm sure I am making a simple mistake. I found similar questions to this on the forum, but none had exactly what I'm looking for.

I have a document that is updated daily to track certain progress in my work team. I have created a separate spreadsheet (currently called "test") where the data will be analyzed. I am trying to create an easy VBA command button to allow other members to quickly copy the necessary data onto the new sheet, updating a table with each paste. For testing purposes, I currently have all data in a single workbook. Ideally, I'd like the data to be appended to my table on test workbook. Originally, I created named ranges for the workbooks, but I have since deleted the names in order to rule out spelling error. I have two tables, "Table2" (to be copied) and "Table4" on the test workbook. The VBA code is below:

Sub Macro3()
Range("Table2").Copy Destination:=Workbooks("test.xlsm").Worksheets("Sheet1!Table4").Range("A1")
End Sub


When I try to execute the command, I get "Run-time error '9': Subscript out of range".

Please let me know if any other information is needed. I'm stuck here.
 

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
19,257
Office Version
  1. 2013
Platform
  1. Windows
Try using

Code:
Worksheets("Sheet1").Range("A1")
 

Watch MrExcel Video

Forum statistics

Threads
1,109,011
Messages
5,526,263
Members
409,689
Latest member
martin_br

This Week's Hot Topics

Top