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

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
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,215,064
Messages
6,122,936
Members
449,094
Latest member
teemeren

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