Subscript out of range error 9 on windows activate

Pophil

New Member
Joined
Aug 3, 2016
Messages
18
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
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
I've seen that before. it says you must save macros in modules. When i check the macro it has the module listed. Is there something else to do
 
Upvote 0
Make sure it starts with Public and not Private.
 
Upvote 0
Thank you all for trying to help. What makes no sense I've had other people run the macro for me from a different computer and it works. The windows activate error is only happening for me.
 
Upvote 0
Try adding the file extension to the workbook name i.e.
VBA Code:
Windows("POOM C REPORT.xlsm").Activate
if it is an xlsm (change extension to suit)
 
Upvote 0
Solution
Thank you all for your help. Is there another vba macro to copy another workbook and paste it into my main workbook (POOM C REPORT)
The issue is the temp report I export automatically always has a different title every time. Also depending on the report sometimes I have it pasted in A1 or anywhere in a specific cell that I choose. I have about 25 tabs (sheets) I use this type of Macro on my various reports As you can see the macro I had never referenced the temp file name nor the actual sheet the data was getting pasted into only had it listed as active sheet. The Call commands I can add in after. Thank you all


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

Quote Reply
Report
 
Upvote 0

Forum statistics

Threads
1,215,072
Messages
6,122,968
Members
449,095
Latest member
Mr Hughes

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