ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using array with Windows().activate (https://www.excelbanter.com/excel-programming/297132-using-array-windows-activate.html)

NikkoW

using array with Windows().activate
 
If it isn't one thing its another. This generates type mismatch error on the
last line. Am I doing something stupid again or, if I can't do it this way,
can someone suggest a better way? Thanks!

Sub ImaNoob()
Dim MyFiles, I As Variant
MyFiles = Array("Con.xls", "CAN1a.xls", _
"CAN1b.xls", "CAN1c.xls")
For Each I In MyFiles
Application.Windows(MyFiles(I)).Activate
....do some stuff
Next I
End Sub



Tom Ogilvy

using array with Windows().activate
 
Sub ImaNoob()
Dim MyFiles, I As Variant
MyFiles = Array("Con.xls", "CAN1a.xls", _
"CAN1b.xls", "CAN1c.xls")
For Each I In MyFiles
Application.Windows(I).Activate
....do some stuff
Next I
End Sub

--
Regards,
Tom Ogilvy



"NikkoW" wrote in message
t.cable.rogers.com...
If it isn't one thing its another. This generates type mismatch error on

the
last line. Am I doing something stupid again or, if I can't do it this

way,
can someone suggest a better way? Thanks!

Sub ImaNoob()
Dim MyFiles, I As Variant
MyFiles = Array("Con.xls", "CAN1a.xls", _
"CAN1b.xls", "CAN1c.xls")
For Each I In MyFiles
Application.Windows(MyFiles(I)).Activate
...do some stuff
Next I
End Sub






All times are GMT +1. The time now is 11:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com