Subscript out of Range Error

jdchap05

New Member
Joined
Jan 4, 2018
Messages
3
I have very little experiance in VBA and I am trying to fix an Excel macro that is giving me a "Subscript out of range error." What the macro is trying to do is to take data from other Excel workboos, copy that data, and paste the data into the Excel workbook named SixEleven. Here is where it is highlighting the error:

Application.ScreenUpdating = False
Application.Run "'SixEleven.xlsm'!unhide"
Application.Run "'SixEleven.xlsm'!openIt"
Worksheets("MA.Front").Range("B16:B61").Copy
Workbooks("SixEleven").Sheets("6 Data").Range("A1:A46").PasteSpecial Paste:=xlPasteValues
Worksheets("MA.Front").Range("L16:R61").Copy
Workbooks("SixEleven").Sheets("6 Data").Range("L1:R46").PasteSpecial Paste:=xlPasteValues
Worksheets("MA.Front").Range("B68:B69").Copy
Workbooks("SixEleven").Sheets("6 Data").Range("A47:A48").PasteSpecial Paste:=xlPasteValues
Worksheets("MA.Front").Range("L68:R69").Copy

Any ideas on what is causing this. The workbook name, sheet name and range are all correct.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
This error can also be due to the sheet not existing.
Are you sure "6 Data" exists in workbook SixEleven
 
Upvote 0
Depending on your system settings, you may need to add the file extension to the workbook name
ie Workbooks("SixEleven.xlsm")
 
Upvote 0
You are missing the file extension in your Workbook name. It needs to be there, i.e.
Workbooks("SixEleven.xls")

Make sure you choose the correct one (".xls", ".xlsx", ".xlsm",etc)
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,216,460
Messages
6,130,771
Members
449,589
Latest member
Hana2911

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