Getting Run-time error '9' Subscript out of range on VBA script

amclaurin

New Member
Joined
Apr 4, 2016
Messages
3
Hi there!
Can someone please help me with the code below? I am simplely setting values from several worksheets to update into one (really copying). I get the "Run-time error '9' Subscript out of range on VBA script"on the lines that are 'not commented out'. The lines that are commented it out seem to have set/copied correctly. What should I do?

Code:
Sub CopyPerThreadValuesForSites()

'Worksheets("Integration").Range("I3:Q3").Value = Worksheets("SS").Range("F61:N61").Value
  Worksheets("Integration").Range("I6:Q6").Value = Worksheets("MS").Range("E65:M65").Value
'Worksheets("Integration").Range("I9:Q9").Value = Worksheets("WS").Range("F72:N72").Value
  Worksheets("Integration").Range("I12:Q12").Value = Worksheets("DS").Range("E66:M66").Value
'Worksheets("Integration").Range("I15:Q15").Value = Worksheets("VL").Range("D54:L54").Value
'Worksheets("Integration").Range("I18:Q18").Value = Worksheets("SO").Range("E73:M73").Value
'Worksheets("Integration").Range("I21:Q21").Value = Worksheets("SR").Range("E66:M66").Value

End Sub

Thanks,
A
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Have you checked that you have sheets named 'SS', 'WS', 'VL' etc in the active workbook when you run the code?
 
Upvote 0
No leading/trailing spaces in the sheet names?
 
Upvote 0
Hi Norie,

I got it...I had a space in each tab! Corrected it and it's working perfectly!

Thank you so so much!
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

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