Monday, November 29, 2004

Find text or values in Excel using VBA

This is some code that I use to locate specific text strings or values.

Note this code will not work as is, but will need you to complete the missing sections.
If you want to use this and don't know how to modify it yourself then email me back with your specific requirements and I can alter it for you.

Sub FindYourText()
Dim ts As Range
Set ts = ActiveSheet.Cells.Find(What:="your text string",Lookin:=xlValues)
If Not ts Is Nothing Then
'do whatever you need to do once you find it
End If
Set ts = Nothing
End Sub