View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default 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.