1

Suppose you have a list of produce (column A) with totals next to them. If you want to find any total (column B) equal to zero and place LOW in the cell next to it (column C), do this:

Set Rng = Range("B1:B16").Find(What:="0", LookAt:=xlWhole, LookIn:=xlValues)
Rng.Offset(, 1).Value = "LOW"

Sub MyOffset()
    With Range("B1:B16")
        Set Rng = .Find(What:="0", LookAt:=xlWhole, LookIn:=xlValues)
        If Not Rng Is Nothing Then
            firstAddress = Rng.Address
            Do
                Rng.Offset(, 1).Value = "LOW"
                Set Rng = .FindNext(Rng)
                Loop While Not Rng Is Nothing And Rng.Address <> firstAddress
        End If
    End With
End Sub
Comintern
  • 21,855
  • 5
  • 33
  • 80
Arie
  • 11
  • 1
  • 2

1 Answers1

1

Find() method looks for a cell in range it's being called upon matching the criteria specified in its parameters ("What", "LookIn", "LookAt", ...) and returns either the found cell reference (a Range object) or the null reference object (referenced with the keyword Nothing) if no matches found

user3598756
  • 28,893
  • 4
  • 18
  • 28
  • Thank you for the explanation – Arie Sep 04 '16 at 13:27
  • 3
    I hope the brave downvoter shows up and explain the reason this answer isn't good so as to both have OP (and other people) on the right way and me improve my answers – user3598756 Sep 04 '16 at 15:08