Macro for improving a search in Excel

June 4, 2009 at 08:38:34
Specs: Windows XP pro SP3
Hi, can someone please help me change the macro code below or any other search macro so that it searchs for ANY MATCH and NOT just an EXACT MATCH, ideally it would copy and paste the list in RANK order. The search terms I am using is a code (A1,B2,C3) but could be changed if its easier. Hope that makes sense, and thankyou for any advice.

The macro below searchs in column B for a match with cell F22, then copies the row from the B group table and pastes it in cells F26 and lower.

Sub Search()
Range("F25").CurrentRegion.ClearContents: Range("F25") = "Results"
FindWhat = UCase(Range("F22"))
For Each Cell In Range("B2", Range("B" & Rows.Count).End(xlUp))
If InStr(Cell, FindWhat) <> 0 Then
Cell.Offset(, -1).Resize(, 3).Copy Range("F" & Rows.Count).End(xlUp).Offset(1, 0)
End If
Next Cell
End Sub

See More: Macro for improving a search in Excel

Report •

June 4, 2009 at 12:56:27
Cells.Find("Results", , xlValues, xlPart).Activate

Report •

June 5, 2009 at 06:30:13
Great thanks for a quick reply, but how do I integrate that into the existing code? Thanks

Report •

Related Solutions

Ask Question