excel search

This is the core function in most of my excel tools, a VBA for searching a rows

Public Function Find_First(my_string As Variant)
Dim Rng As Range
If Trim(my_string) <> “” Then
With Sheets(“Sheet1”).Range(“A:A”)
Set Rng = .Find(What:=epm_domain, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
If Not Rng Is Nothing Then
MY_COLUMN2_VAL = Sheets(“Sheet1”).Cells(Rng.Row, 2).Value
MsgBox “Nothing found”
End If
End With
End If
End Function


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s