Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Subscript out of range problem
This assumes the referenced workbook is open.
Even though you have verified the spelling is correct, it is incorrect or you wouldn't get the error (assuming that line causes the error). Assuming the book is the activewindow when you run the code. Dim wndw as Window set wndw = Activewindow Workbooks.Open Filename:= _ "C:\My Documents\cat.xls" wndw.Activate msgbox "-" & lcase(Application.Substitute(activeworkbook.Name," ","_")) _ & "<-" & vbnewline & _ lcase(Application.Substitute("-C C Schedule Regular.xls<-"," ","_")) otherwise Dim bk as Workbook Workbooks.Open Filename:= _ "C:\My Documents\cat.xls" for each bk in Workbooks if instr(1,bk.Name,"Sched",vbTextCompare")0 then bk.Activate exit for End if Next Or check the spelling again - might have two spaces where you only think there is one. -- Regards, Tom Ogilvy "Darrell Wesley" wrote in message ... The following lines of code yield a "Subscript out of range" error 9. Workbooks.Open Filename:= _ "C:\My Documents\cat.xls" Windows("C C Schedule Regular.xls").Activate Both xls documents are in the same folder and spelling including spaces has been verified as correct. Why does this yield a Subscipt out of range error? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Subscript out of range problem | Excel Programming | |||
Subscript out of range problem | Excel Programming | |||
Subscript out of range? | Excel Programming | |||
Excel Macro Problem, Add-in need to work in every workbook & Error:9 Subscript out of range | Excel Programming | |||
Subscript Out of Range | Excel Programming |