Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
vba conditional loops
This one should be easy for someone used to vba.
I've got three named ranges on the same sheet called "DataDownload" (LSRatio, LongPrice, ShortPrice). LSRatio is the range I want to populate LongPrice and ShortPrice are price series going down different columns. I want to do a loop in the LSRatio range that first checks that LongPrice and ShortPrice are not empty, and if this is the case, calculate LSRatio as LongPrice/ShortPrice until I reach the point where LongPrice and ShortPrice end (ie cells become empty) at which point the procedure ends. Any help would be greatly appricated |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
vba conditional loops
Assume Longprice and Shortprice will be the same size and populated to the
same extent i = 0 for each cell in Rane("shortprice") i = i + 1 if not isempty(cell) then range("lsratio")(i).Value = Range("Longprice")(i).Value/cell.Value else exit for end if Next -- Regards, Tom Ogilvy "Benoit" wrote: This one should be easy for someone used to vba. I've got three named ranges on the same sheet called "DataDownload" (LSRatio, LongPrice, ShortPrice). LSRatio is the range I want to populate LongPrice and ShortPrice are price series going down different columns. I want to do a loop in the LSRatio range that first checks that LongPrice and ShortPrice are not empty, and if this is the case, calculate LSRatio as LongPrice/ShortPrice until I reach the point where LongPrice and ShortPrice end (ie cells become empty) at which point the procedure ends. Any help would be greatly appricated |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Loops... | Excel Discussion (Misc queries) | |||
do loops | Excel Worksheet Functions | |||
Do loops within Do loops | Excel Programming | |||
Do Loops | Excel Programming | |||
help with loops | Excel Programming |