Subscript out of range error 9 on windows activate

Pophil

New Member
Joined
Aug 3, 2016
Messages
25
I have an excel program xlsm that recently one of the macros I use to export data from another excel workbook says subscript out of range error 9. Basically I have a master excel workbook that has many different tabs. On each tab I have a macro export button that takes the data from the other excel workbook and moves it into the master excel workbook along with other macros I have listed in it. The main workbook is called POOM C REPORT. When I see the debug issue it shows that the Windows("POOM C REPORT").Activate is the issue. Everything I have researched shows that the title of my workbook is different even though the workbook has the same title as POOM C REPORT. The other excel workbooks I open will usually always have a different title so this macro was good because it didn't reference the temp workbook I had open that the data I needed came from. Also in that macro the Windows("POOM C REPORT").Activate is there 3 times so even if the first issue is fixed I have a feeling the other two window activate prompts will show as an issue. Any help you can be is greatly appreciated. I use this report for about 22 different reports. Thank you all


Sub ExportFromMTEL()
'
' ExportFromMTELRIMS3 Macro
'

'
Dim answer As VbMsgBoxResult

answer = MsgBox("Is RIMS Tool & Export from RIMS the ONLY two Excel Workbooks presently open?", vbYesNo, "HOTETZ RIMS TOOL WARNING!")

If answer = vbNo Then

MsgBox "Well then open them...", vbOKOnly, "Duhh!"

End If

If answer = vbYes Then

ActiveWindow.WindowState = xlMinimized
Call COPYMTEL

Selection.Copy
Windows("POOM C REPORT").Activate
ActiveWindow.WindowState = xlMaximized
Range("A1").Select
ActiveSheet.Paste
Range("A1").Select
ActiveWindow.WindowState = xlMinimized
Application.DisplayAlerts = False
ActiveWindow.Close SaveChanges:=False
Windows("POOM C REPORT").Activate
ActiveWindow.WindowState = xlMaximized




End If

Windows("POOM C REPORT").Activate
ActiveWindow.WindowState = xlMaximized
Call STEP6
End Sub
 
Yes they are both open at the same time
I meant in the same excel instance.
Check in the Windows Task Manager (Press CTRL +SHIFT + ESC) .Under the Details tab, see how many instances of the excel exe there is.
 
Upvote 0

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
I meant in the same excel instance.
Check in the Windows Task Manager (Press CTRL +SHIFT + ESC) .Under the Details tab, see how many instances of the excel exe there is.
Oh ok
Under PID it's 6884
Status running
Cpu 00
Memory 265,464K
Uac virtulization. Disabled
 
Upvote 0
Question the excel program will work on other computers but not my main one. What would cause that to show the debug error every time.
 
Upvote 0
What happens if you use
VBA Code:
Workbooks("POOM C REPORT").Activate
 
Upvote 0
Put the code below in a module in the POOM C REPORT workbook, then run the code... what number appears in the message box?

VBA Code:
Sub Testme()
MsgBox Len(ThisWorkbook.Name)
End Sub
 
Upvote 0
Put the code below in a module in the POOM C REPORT workbook, then run the code... what number appears in the message box?

VBA Code:
Sub Testme()
MsgBox Len(ThisWorkbook.Name)
End Sub
Thank you so much. I just did a combination of things you said to try. I changed to workbook then added .xlsm. Together they both worked but separately they didn't. Can't thank you enough.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,154
Members
453,021
Latest member
Justyna P

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