Computing.Net > Forums > Programming > Macro for improving a search in Excel

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Macro for improving a search in Excel

Reply to Message Icon

Name: newton_p
Date: June 4, 2009 at 08:38:34 Pacific
OS: Windows XP pro SP3
Subcategory: General
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: June 4, 2009 at 12:56:27 Pacific
Reply:

Cells.Find("Results", , xlValues, xlPart).Activate


0

Response Number 2
Name: newton_p
Date: June 5, 2009 at 06:30:13 Pacific
Reply:

Great thanks for a quick reply, but how do I integrate that into the existing code? Thanks


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Macro for improving a search in Excel

Iteration through a Range in Excel www.computing.net/answers/programming/iteration-through-a-range-in-excel/14811.html

Forecasting in excel www.computing.net/answers/programming/forecasting-in-excel/17948.html

alert boxes in excel www.computing.net/answers/programming/alert-boxes-in-excel/18550.html