Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Loop Until LDate Column Date
I have a form that looks up a string value (CWWNo Col A) in a worksheet
(CWW List) and then places the string value into a form textbox (CWW1). I am currently using the following code but I want the loop to end once I have retrieved the first CWWNo date value (Col B) that exceeds the LDate into the form: What type of loop can I use that can loop the worksheet until it meets this condition? CWW List Worksheet Col A Col B CWW1 03/16/2009 CWW1 04/6/2009 CWW1 4/27/2009 CWW1 5/18/2009 Set wsMaster = Workbooks("Collections Master Database2.xls").Worksheets("CWW List") CWWNo.Value = Combobox1.Column(23) While Not IsEmpty(Worksheets("CWW List").Cells(LoopRow, LoopCol)) With wsMaster If CWWNo = wsMaster.Range("a" & iRow + 0) Then If LDate wsMaster.Range("b" & iRow + 0) Then iRow = iRow + 1 LoopRow = LoopRow + 1 Else CWW1 = wsMaster.Range("b" & iRow + 0) CWW2 = wsMaster.Range("b" & iRow + 0) + 21 CWW3 = wsMaster.Range("b" & iRow + 0) + 42 CWW4 = wsMaster.Range("b" & iRow + 0) + 63 CWW5 = wsMaster.Range("b" & iRow + 0) + 84 CWW6 = wsMaster.Range("b" & iRow + 0) + 105 CWW7 = wsMaster.Range("b" & iRow + 0) + 126 CWW8 = wsMaster.Range("b" & iRow + 0) + 147 CWW9 = wsMaster.Range("b" & iRow + 0) + 168 CWW10 = wsMaster.Range("b" & iRow + 0) + 189 'Exit Do End If Else iRow = iRow + 1 LoopRow = LoopRow + 1 End If End With Wend |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Referencing date column A & time column B to get info from column | Excel Discussion (Misc queries) | |||
open files in loop with date order | Excel Discussion (Misc queries) | |||
Loop Column | Excel Discussion (Misc queries) | |||
Need the formula or macro. If i enter today date in the cell (Row 1,Column 2) and on tab out, the column 1 cell should be filled with "corresponding Day" of the date | Excel Discussion (Misc queries) | |||
loop thru column and highlight the rows | Excel Discussion (Misc queries) |