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

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
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,214,865
Messages
6,121,988
Members
449,060
Latest member
mtsheetz

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