error copy and paste by vba

gakiss2

New Member
Joined
Dec 5, 2018
Messages
17
seems like a very simple task and I've tried a few different methods since its not working. line in vba:

Worksheets("Sheet3").Range("g2:j1000").Value = Worksheets("Sheet4").Range("g2:j1000").Value

Other methods include calling Sheets("... instead of Worksheets("... Another method included something about paste special. I've tried a command to Activate sheet as I am pulling data from another worksheet, same workbook.
I keep getting error 9, subscript out of range. I have successfully used this just Range().value in this same workbook, same page. So I wonder if it has something to do with pulling in data from another sheet but I can't figure what I am doing wrong. Could use a nudge to get out of this rut.

Thank You
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
what about this?

Code:
Sub CPerror()
Sheets("Sheet4").Range("G2:J1000").Copy Sheets("Sheet3").Range("G2:J1000")
End Sub
 
Last edited:
Upvote 0
seems like a very simple task and I've tried a few different methods since its not working. line in vba:

Worksheets("Sheet3").Range("g2:j1000").Value = Worksheets("Sheet4").Range("g2:j1000").Value

Other methods include calling Sheets("... instead of Worksheets("... Another method included something about paste special. I've tried a command to Activate sheet as I am pulling data from another worksheet, same workbook.
I keep getting error 9, subscript out of range. I have successfully used this just Range().value in this same workbook, same page. So I wonder if it has something to do with pulling in data from another sheet but I can't figure what I am doing wrong. Could use a nudge to get out of this rut.

Thank You
Check your worksheet names or use the codenames of the worksheets instead instead.

Example :
Code:
 sheet57.Range("G2:J1000").Value = sheet22.Range("G2:J1000").Value
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

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