Run-time 9 Error

dhill0502

New Member
Joined
Apr 10, 2019
Messages
6
For the life of my I cannot figure out why the following line of code is giving me a "Run-time error '9': Subscript out of range" Error.

Workbooks("Lookup").Worksheets("Sheet1").Range("A1:BK2000").Copy Destination:=Workbooks("EstimateChecker").Worksheets("estsheet").Range("A1:BK2000")

I am trying to copy sheet1 from the workbook Lookup into the sheet estsheet in the EstimateChecker workbook. Any help would be appreciated.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi,

You can test

Code:
[COLOR=#333333]Workbooks("EstimateChecker").Worksheets("estsheet").Range("A1:BK2000").Value = [/COLOR][COLOR=#333333]Workbooks("Lookup").Worksheets("Sheet1").Range("A1:BK2000").Value[/COLOR]

Hope this will help
 
Upvote 0
Hi & welcome to MrExcel
Assuming that both sheet names & workbook names are correct, try adding the file extension to the workbook names.
 
Last edited:
Upvote 0
I tried the suggestion from James and got the same error. I have tried using the file extensions which for what I know are xlsm for the EstimateChecker which is a Office 2010 Macro-Enabled Workbook. I also tried using xlsx and xls for the Lookup workbook. The Lookup workbook is exported from my computer system, which is old, into an excel sheet and it says it has to open it in Compatibility Mode so I tried using the xls which is for 97-2003 Excel files. Either way using any combination of the file extensions gives the same error.
 
Upvote 0
With the lookup workbook open look in the Title bar & you should see something like Lookup.??? [Compatability mode] - Excel
What does it say in place of the ???
 
Upvote 0
Ok, let's try and narrow it down. What happens if you run this (with both workbooks open)
Code:
Sub chk()
   Workbooks("EstimateChecker.xlsm").Activate
   Worksheets("estsheet").Select
   Workbooks("Lookup").Activate
   Worksheets("Sheet1").Select
End Sub
 
Upvote 0
The problem after using your test is with Lookup workbook. I tried using xls and xlsx file extensions in the name and it gave me the same error. I have no way of changing the export to excel functionality of the outdated software so if the problem is that it is exporting the excel file in the Compatibility Mode, which I think means something to do with a 97-2003 Version, then I will just have to copy and paste the old way.
 
Upvote 0
With the Lookup workbook active run this
Code:
Sub chk()
Debug.Print "|" & ActiveWorkbook.Name & "|"
End Sub
The copy paste the result in the immediate window to the thread.
The Immediate window is normally below the main code window & Ctrl G will bring it up if not visible
 
Upvote 0
|Lookup.xlsm|

That is the result from running the sub you had me run. Unfortunately after changing the file extension in the original code to .xlsm I got the same error.

Workbooks("Lookup.xlsm").Worksheets("Sheet1").Range("A1:BK2000").Copy Destination:=Workbooks("EstimateChecker.xls").Worksheets("estsheet").Range("A1:BK2000")

Just to be clear that is the latest code that was used and still I got the Run-Time error '9'
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,272
Members
452,628
Latest member
dd2

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