Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find last occurrence of the value Yes
I have column R, which contains a series of Yes, and No values. There are
also blank cells within the column. I need some code that will find the last occurrence of Yes in the column and select it. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find last occurrence of the value Yes
Try the below code which works on 'Sheet1' Col R. Adjust to suit
Sub Macro() Dim varFound As Variant, varRange As Variant With Worksheets("Sheet1").Range("R:R") Set varFound = .Find("Yes", LookIn:=xlValues) If Not varFound Is Nothing Then Do Set varRange = varFound Set varFound = .FindNext(varFound) Loop While Not varFound Is Nothing And _ varFound.Row varRange.Row varRange.Select End If End With End Sub If this post helps click Yes --------------- Jacob Skaria "ordnance1" wrote: I have column R, which contains a series of Yes, and No values. There are also blank cells within the column. I need some code that will find the last occurrence of Yes in the column and select it. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find last occurrence of the value Yes
I believe this macro will do what you want...
Sub FindLastYes() On Error Resume Next Columns("R").Find("Yes", MatchCase:=False, _ SearchDirection:=xlPrevious).Select End Sub -- Rick (MVP - Excel) "ordnance1" wrote in message ... I have column R, which contains a series of Yes, and No values. There are also blank cells within the column. I need some code that will find the last occurrence of Yes in the column and select it. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find Last Occurrence of Number | Excel Discussion (Misc queries) | |||
How to find SECOND occurrence in a string? | Excel Worksheet Functions | |||
find first occurrence of data in a column | Excel Programming | |||
Find nth occurrence and replace with ":" | Excel Worksheet Functions | |||
find last occurrence | Excel Worksheet Functions |