LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default Multiple test loops

I'm trying to create a macro to mark flags in a worksheet to be used in
another program to analyze data.
The sheet looks something like this:


ID Flag Date
G4 0 02/25/04
H6 1 09/07/03


Actually, there are additional fields between these with text and
numbers not relevant to the macro.
I want the macro to search first in the Flag field until it finds a
"1". I want it to store the ID (iBaseSID) and date (iBaseDate), and
calculate the date 90 days earlier (iEarlyDate). I then want it to
back up one line and compare ID's to see if they are the same. If they
are, I want it to check and see if the CurDate (the date on the current
line) is greater than the EarlyDate (BaseDate-90). If both conditions
are met, I want it to change the current Flag to 1 (It won't be 1
because it was tested before and didn't = 1, other wise the macro would
be start testing the other variables on that line).
I want it to contunue moving up one line at at time, changing the flag
until one of the conditions is not met, then go to the line below the
Base line and repeat the process going down, except that the date it
will be testing for is iLateDate (iBaseDate + 90) and it will test for
less than or equal to. (Actually, there is a third test that will be
run, but I figured that if I got the code to get me this far, I can
figure out how to add one more test loop.)
The loops end when the cell is blank, or when the range ends (each
column is a named range), whichever is easiest.
Thanks for the help!

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Logical Test with multiple cells Deanna Excel Worksheet Functions 2 October 20th 08 03:34 AM
Trying to test for multiple of 5, or .5, .05, .005, .0005 nastech Excel Discussion (Misc queries) 10 August 8th 07 04:52 AM
Trying to test for multiple of 5, or .5, .05, .005, .0005 nastech Excel Discussion (Misc queries) 8 August 3rd 07 10:16 PM
Multiple loops one result hotherps[_56_] Excel Programming 2 May 11th 04 06:09 PM
macro that loops to multiple columns Brad Zenner Excel Programming 1 July 22nd 03 03:17 AM


All times are GMT +1. The time now is 06:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"