Searching a row ( record )
Try out the below macro...You can specify the data to be searched in the
variable varSearch as string columns separated by a pipe symbol. The below
macro check for a data in 1 2 3 in ColA ColB and ColC
Sub FindRowData()
'Jacob Skaria
Dim varFound As Variant, varSearch As Variant
Dim strAddress As String, arrSearch As Variant
Dim blnMismatch As Boolean, blnFound As Boolean
varSearch = "1|2|3"
arrSearch = Split(varSearch, "|")
ActiveSheet.UsedRange.Font.ColorIndex = 0
With ActiveSheet.Columns(1)
Set varFound = .Find(arrSearch(0), _
LookIn:=xlValues, LookAt:=xlWhole)
If Not varFound Is Nothing Then
strAddress = varFound.Address
Do
blnMismatch = False
For intTemp = 1 To UBound(arrSearch)
If CStr(varFound.Offset(, _
intTemp)) < arrSearch(intTemp) Then _
blnMismatch = True: Exit For
Next
If Not blnMismatch Then Exit Do
Set varFound = .FindNext(varFound)
Loop While Not varFound Is Nothing And _
varFound.Address < strAddress
If Not blnMismatch Then
varFound.Resize(, intTemp).Font.ColorIndex = 3
Application.Goto varFound, True
blnFound = True
End If
End If
End With
If Not blnFound Then MsgBox "Cannot find the data" & _
vbLf & vbLf & varSearch
End Sub
If this post helps click Yes
---------------
Jacob Skaria
"Aligahk06" wrote:
Dear All,
I have an excel workbook in which more than 25000 rows ( Records ).
I want to find an individual row (record) with all column fields.
e.g Record Res pipe 4" 50 6 23.7 A particular record contains so many column
fields.
I have an option through CTRL +F but we can not supply the entire fields.
Can i do this by macro.
Please assist ?
Rgds,
Aligahk06
|