Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Check cell range for a fragment

I would probably use vba FIND instead but what about partial matches. If
desired, send your file to my address below along with this msg, a clear
explanation and before/after examples.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software


"NewsOfTheDay" wrote in message
...
Hi,

I would like to find a way to search through an experimental list of car
registration, which is alphanumeric. What I want to do is use VBA to find
the registration number using only part of the registration plate number
which will be inputted by the user into an input message box.

I have got an Input Box in place for the user to enter the partial
registration plate number. I want excel to find the cell location from the
list that hold the fully matching registration number, and once it's found
it, to then fill the cell with the colour it green. I'm not sure where to
put this line

If myCell Like ("*" & junk & "*") Then

Here is the full code below;

Sub getValidVehicle()

Dim thisReg As Variant

Dim myCell As Object

Dim Vehicle_Reg As Object

Dim isfound As Boolean

Dim junk As Object 'fragment of registration holder

Worksheets("Sheet1").Select

isfound = False

Do Until isfound

thisReg = InputBox(Prompt:="enter registration")

For Each myCell In Range("Vehicle_Reg")

If myCell Like ("*" & junk & "*") Then 'found it

myCell.Interior.ColorIndex = 10

isfound = True

MsgBox "found at" & myCell.Address

End If

Next

Loop

End Sub

(thank you) Terry



Reply
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
text fragment comparison ChrisM Excel Worksheet Functions 2 January 6th 10 11:42 PM
Check no cell is the same within a range Neil Pearce Excel Discussion (Misc queries) 3 October 23rd 08 01:46 PM
check that active cell is within a range alstubna Excel Programming 2 February 16th 08 09:37 PM
Check if cell values is in one range loopoo[_12_] Excel Programming 1 November 22nd 05 09:58 AM
Check to see if cell data is within a range mwrfsu Excel Worksheet Functions 4 August 22nd 05 10:40 PM


All times are GMT +1. The time now is 07:26 AM.

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

About Us

"It's about Microsoft Excel"