VBA - copy range from one worksheet to another

wibni

New Member
Joined
Jun 15, 2011
Messages
33
Hi,

In Excel 2003 how can I copy a range from one worksheet to another using VBA

The code below gives me a type mismatch error.
Code:
For i = 1 To 11
    Worksheets.Add after:=Worksheets(Worksheets.Count), Count:=1
    Worksheets("Sheet2").Range("A1:D3") = Worksheets(Sheet1).Range("A1:D3")
Next i
 

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.
Perhaps you mean like this

Rich (BB code):
For i = 1 To 11
    Worksheets.Add after:=Worksheets(Worksheets.Count), Count:=1
    ActiveSheet.Range("A1:D3") = Worksheets("Sheet1").Range("A1:D3")
Next i
 
Upvote 0
Thank you. I overlooked that.
The error is gone, however it still does not copy my range from Sheet1 to Sheet2.
What am I missing?
 
Upvote 0
Sorry, it should be

Rich (BB code):
ActiveSheet.Range("A1:D3").Value = Worksheets("Sheet1").Range("A1:D3").Value
 
Upvote 0
Perfect, that worked.

Is it possible to just specify 1 cell in the target sheet and it just fills the columns and rows as needed?

The code below only copies 1 value across. I was hoping to use "A1" just as s reference where the paste should start from.

Code:
For i = 1 To 11
    Worksheets.Add after:=Worksheets(Worksheets.Count), Count:=1
    ActiveSheet.Range("A1").Value = Worksheets("Sheet1").Range("A1:D3").Value
Next i
 
Upvote 0
Try

Code:
For i = 1 To 11
    Worksheets.Add after:=Worksheets(Worksheets.Count), Count:=1
    Worksheets("Sheet1").Range("A1:D3").Copy Destination:=ActiveSheet.Range("A1")
Next i
 
Upvote 0

Forum statistics

Threads
1,215,488
Messages
6,125,092
Members
449,206
Latest member
ralemanygarcia

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