Do Until Statements

waxb18

Board Regular
Joined
May 31, 2011
Messages
179
Ive read up a little bit about Do Until statements,

What i wanted to know was how would i go about combining a vlookup statement with a "do until" the date = 30/11/2010

the date is in column P
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
What do you want to do once it finds the cell value?
 
Upvote 0
One of the purposes of VLOOKUP is to avoid Do...Loop Until loops.

Code:
Dim i As Long

i = 1
Do
    If Cells(i, 1) = "cat" Then 
        MsgBox Cells(i, 3)
        Exit Sub
    End If
    i = i + 1
Loop Until Cells(i, 1) = vbNullString
does the same thing as

Code:
MsgBox WorksheetFunction.VLookup("cat", Range("A1:C9999"), 3, False)
 
Upvote 0
its ok i sussed it:

Range("AD2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-26],'[FM REPORT 2011-12 TEMPLATE =.xlsm] Raw Data'!C4:C30,27,FALSE)"

Range("P2").Select
Do Until Left(ActiveCell * 1, 5) * 1 >= 40513
ActiveCell.Offset(1, 0).Select
Loop

myrow = ActiveCell.Row - 3

Range("AD2").Select
Range(ActiveCell, ActiveCell.Offset(myrow, 0)).Select
Selection.FillDown
ActiveSheet.Calculate
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,707
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top