Excel Tech Support VBA Excel

Copper Contributor

VBA runs the same code on win 10 32-bit but does run on win 10 64-bit it hangs on the this line of code “Windows("A3 Daily Ups and Downs.xlsm").Activate”  and gives this error “run time error 9” and “subscript out of range”.  “A3 Daily Ups and Downs.xlsm” is the same Workbook that contains the VBA script that I am running.   Why can’t find it?  I have tried everything and I can’t fix it.

1 Reply


The error "Subscript out of range" typically occurs when VBA is trying to access a workbook, worksheet, or range that does not exist or has been deleted. In your case, it seems that the issue is with the code trying to activate a workbook that is not open or cannot be found.

One possible solution is to use the full path of the workbook instead of just the filename.

Here's an example:

Workbooks("C:\Users\YourUserName\Documents\A3 Daily Ups and Downs.xlsm").Activate

Make sure to replace "YourUserName" with your actual Windows username and use the correct path to the workbook.

Another possibility is that the workbook is open, but not visible or active. In this case, you can try using the "Windows" collection to activate the workbook:

Windows("A3 Daily Ups and Downs.xlsm").Activate

If neither of these solutions work, you can try checking if the workbook is already open using the "Workbooks" collection and activate it if it is:

Dim wb as Workbook
Set wb = Nothing
On Error Resume Next
Set wb = Workbooks("A3 Daily Ups and Downs.xlsm")
On Error GoTo 0

If wb Is Nothing Then
    MsgBox "Workbook not found"
End If

This code will first try to set a reference to the workbook, and if it fails, it will display a message. If it succeeds, it will activate the workbook. Make sure to replace "A3 Daily Ups and Downs.xlsm" with the actual filename of your workbook.


*Check the spelling of the workbook name in your code and make sure it matches the actual name of the workbook.


I hope this helps!