Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling windows with variables
below is part of a macro which copies information from one
work sheet to another.I switch backwards and forwards betwen my quote window and my program window several times.I used to use ActiveWindow.Activate Next but if there are aother excel windows open it may open the wrong window.The "myprog" varable work fine and opens the program window but the "myquote" varaiable doesnt even though the correct variable is stored(a 4 or 5 digit number) myquote = Range("B6") myprog = Format(Date, "mmmyy") Workbooks.Open Filename:="\\wxp107475\Brians Docs\Program Sheets\" & myprog & " Factory Program.xls" Windows(myquote).Activate'runtime error 9..out of range 'Windows("12000").Activate'the 12000 will change Sheets("Program").Select If Range("L13") 0 Then Range("frames").Sort Key1:=Range("F6"), Order1:=xlDescending, Header:=xlNo, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Range("frames").Resize(Range("frames").Rows.Count - Range("M13").Value).Copy Windows(myprog & " Factory Program").Activate'works fine |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling windows with variables
What is in cell B6 of the active window?
-- Vasant "Paul" wrote in message ... below is part of a macro which copies information from one work sheet to another.I switch backwards and forwards betwen my quote window and my program window several times.I used to use ActiveWindow.Activate Next but if there are aother excel windows open it may open the wrong window.The "myprog" varable work fine and opens the program window but the "myquote" varaiable doesnt even though the correct variable is stored(a 4 or 5 digit number) myquote = Range("B6") myprog = Format(Date, "mmmyy") Workbooks.Open Filename:="\\wxp107475\Brians Docs\Program Sheets\" & myprog & " Factory Program.xls" Windows(myquote).Activate'runtime error 9..out of range 'Windows("12000").Activate'the 12000 will change Sheets("Program").Select If Range("L13") 0 Then Range("frames").Sort Key1:=Range("F6"), Order1:=xlDescending, Header:=xlNo, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Range("frames").Resize(Range("frames").Rows.Count - Range("M13").Value).Copy Windows(myprog & " Factory Program").Activate'works fine |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling windows with variables
Windows(myquote & ".xls").Activate 'runtime
-- Regards, Tom Ogilvy "Paul" wrote in message ... below is part of a macro which copies information from one work sheet to another.I switch backwards and forwards betwen my quote window and my program window several times.I used to use ActiveWindow.Activate Next but if there are aother excel windows open it may open the wrong window.The "myprog" varable work fine and opens the program window but the "myquote" varaiable doesnt even though the correct variable is stored(a 4 or 5 digit number) myquote = Range("B6") myprog = Format(Date, "mmmyy") Workbooks.Open Filename:="\\wxp107475\Brians Docs\Program Sheets\" & myprog & " Factory Program.xls" Windows(myquote).Activate'runtime error 9..out of range 'Windows("12000").Activate'the 12000 will change Sheets("Program").Select If Range("L13") 0 Then Range("frames").Sort Key1:=Range("F6"), Order1:=xlDescending, Header:=xlNo, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Range("frames").Resize(Range("frames").Rows.Count - Range("M13").Value).Copy Windows(myprog & " Factory Program").Activate'works fine |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling windows with variables
Thanks Tom it works!!!!
-----Original Message----- Windows(myquote & ".xls").Activate 'runtime -- Regards, Tom Ogilvy "Paul" wrote in message ... below is part of a macro which copies information from one work sheet to another.I switch backwards and forwards betwen my quote window and my program window several times.I used to use ActiveWindow.Activate Next but if there are aother excel windows open it may open the wrong window.The "myprog" varable work fine and opens the program window but the "myquote" varaiable doesnt even though the correct variable is stored(a 4 or 5 digit number) myquote = Range("B6") myprog = Format(Date, "mmmyy") Workbooks.Open Filename:="\\wxp107475\Brians Docs\Program Sheets\" & myprog & " Factory Program.xls" Windows(myquote).Activate'runtime error 9..out of range 'Windows("12000").Activate'the 12000 will change Sheets("Program").Select If Range("L13") 0 Then Range("frames").Sort Key1:=Range("F6"), Order1:=xlDescending, Header:=xlNo, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Range("frames").Resize(Range ("frames").Rows.Count - Range("M13").Value).Copy Windows(myprog & " Factory Program").Activate'works fine . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
cannot open exel from windows xp in windows vista and visa versa | New Users to Excel | |||
can windows vista edit shared document from windows xp | Excel Worksheet Functions | |||
macro calling another macro + variables | Excel Discussion (Misc queries) | |||
Page breaks are different in Windows 2000 and Windows XP | Excel Discussion (Misc queries) | |||
Calling .Net Windows services | Excel Programming |