Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 313
Default 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
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
Referencing date column A & time column B to get info from column TVGuy29 Excel Discussion (Misc queries) 1 January 24th 08 09:50 PM
open files in loop with date order [email protected] Excel Discussion (Misc queries) 5 September 24th 07 01:10 AM
Loop Column Lisa Excel Discussion (Misc queries) 2 July 17th 07 06:14 PM
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 kakasay Excel Discussion (Misc queries) 1 January 22nd 07 12:31 PM
loop thru column and highlight the rows mariasa Excel Discussion (Misc queries) 1 July 1st 06 08:53 AM


All times are GMT +1. The time now is 09:36 PM.

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

About Us

"It's about Microsoft Excel"