Run-time Error "9" Subscript out of range

jhpaul1220

New Member
Joined
Oct 16, 2014
Messages
13
So I keep getting a "Run-time Error "9" Subscript out of range" on the third line (marked in bold) and I don't know how to fix it. Any thoughts?


Private Sub CommandButton1_Click()




Dim LR




Worksheets("Sheet2").Activate
LR = ActiveSheet.Range("B" & Rows.Count).End(xlUp).Row + 1








Sheet1.Range("B2").Copy Sheet2.Range("B" & LR)
Sheet1.Range("B3").Copy Sheet2.Range("C" & LR)
Sheet1.Range("B4").Copy Sheet2.Range("E" & LR)
Sheet1.Range("C30").Copy Sheet2.Range("F" & LR)
Sheet1.Range("C27").Copy Sheet2.Range("F" & LR)
Sheet1.Range("C12").Copy Sheet2.Range("G" & LR)
Sheet1.Range("G29").Copy Sheet2.Range("H" & LR)








End Sub
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
That error indicates that there is no sheet named "Sheet2" in the currently active workbook.
Check for exact spelling, and extra spaces on the sheet's tab name "Sheet2" vs " Sheet2" or "Sheet2 "
 
Upvote 0

Forum statistics

Threads
1,216,456
Messages
6,130,743
Members
449,588
Latest member
accountant606

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