LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Search string in cells for a criteria in a list


Hi,

Looking to find the main location of a event.

Here's some examples of types of entries and the expected results

_CRITERIA
Chelsea
Liverpool
Manchester Utd
Old Trafford
Cardiff
Scotland
Italy
England
Greece

FA Cup Semi Final Chelsea v Liverpool @ Old Trafford = Result Ol
Trafford
FA Cup Semi Final Chelsea v Liverpool @ Old Trafford = Result Ol
Trafford
MOTD Liverpool v Manchester Utd = Result Liverpool
Concert Cardiff = Result Cardiff
Six Nations Ireland V England = Result Ireland
Six Nations Scotland V Italy = Result Scotland
World Rally Greece = Result Greece


I got the below code at the moment which finds the first team. Anyon
got any ideas to deal with the @ senario's ??



Code
-------------------

Dim SrchRange, SrchCriteria As Object
Dim ChckName As Object

Sub wholeprocedure()

Set SrchRange = Range(Cells(2, 10), Cells(8, 10))
For Each SrchCriteria In SrchRange
If SrchCriteria = blank Then
Exit Sub
Else
Call Checkcell
End If

Next

End Sub



Sub Checkcell()

With Worksheets(1).Range("B7:B500")

Set ChckName = .Find(SrchCriteria, LookIn:=xlValues)
If Not ChckName Is Nothing Then
firstAddress = ChckName.Address
Do
Position = ChckName.Offset(0, 3).Range("A1").Value
If Position = blank Then
ChckName.Offset(0, 2).Range("A1").Value = SrchCriteria
ChckName.Offset(0, 3).Range("A1").Value = Application.WorksheetFunction.Find(SrchCriteria, ChckName, 1)
ElseIf Application.WorksheetFunction.Find(SrchCriteria, ChckName, 1) < Position Then
ChckName.Offset(0, 2).Range("A1").Value = SrchCriteria
ChckName.Offset(0, 3).Range("A1").Value = Application.WorksheetFunction.Find(SrchCriteria, ChckName, 1)
End If
Set ChckName = .FindNext(ChckName)
Loop While Not ChckName Is Nothing And ChckName.Address < firstAddress
End If
End With

End Su
-------------------


Thanks in Advance

VBA Noo

--
VBA Noo
-----------------------------------------------------------------------
VBA Noob's Profile: http://www.excelforum.com/member.php...fo&userid=3383
View this thread: http://www.excelforum.com/showthread.php?threadid=53786

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Returning a text string after a 2 criteria search Spag Excel Discussion (Misc queries) 4 July 11th 08 01:49 PM
Search string with multiple criteria fLiPMoD£ Excel Worksheet Functions 2 May 5th 05 08:02 PM
Excel XP VBA code to search all macro code in Excel module for specific search string criteria Ed[_18_] Excel Programming 4 May 20th 04 02:08 PM
Excel XP VBA code to search all macro code in Excel module for specific search string criteria Frank Kabel Excel Programming 0 May 19th 04 08:11 PM
Use sheet name as search string or autofilter criteria Magar Excel Programming 1 November 14th 03 01:06 PM


All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"