Skip to content

Instantly share code, notes, and snippets.

@DataSolveProblems
Created May 11, 2019 02:21
Show Gist options
  • Select an option

  • Save DataSolveProblems/14ce61ff5d75feaafd9e9cb445b6b87b to your computer and use it in GitHub Desktop.

Select an option

Save DataSolveProblems/14ce61ff5d75feaafd9e9cb445b6b87b to your computer and use it in GitHub Desktop.
Sub Lookup_Demo()
Dim ColorName As String, firstAddress As String
Dim rangeLookup As Range, rangeOutput As Range
Dim v As Range
ColorName = "Red"
Set rangeLookup = Range("C3:C8")
Set rangeOutput = Range("D3:D8")
Set v = rangeLookup.Find(ColorName)
If Not v Is Nothing Then
firstAddress = v.Address
Do
v.Offset(0, -1).Value = v.Offset(0, -1).Value + 100000
Set v = rangeLookup.FindNext(v)
Loop While v.Address <> firstAddress
End If
'// Release object memory
Set rangeLookup = Nothing
Set rangeOutput = Nothing
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment