vbscript .find ignore spaces

dillyoh

New Member
Joined
Aug 22, 2018
Messages
12
I have a script that searches phone numbers
Code:
Set rngFind = .Find(What:=Trim(txtLookup.Text), LookIn:=xlValues, LookAt:=xlPart)
Some of the numbers have spaces and some are just numbers.
eg in the database a phone number may show up as "0218888888" or "021 888 888"

Is there a way so when my .find looks for the number it will search both? ignore the spaces?
 

Some videos you may like

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

gallen

Well-known Member
Joined
Jun 27, 2011
Messages
1,996
I don't think there is using the 'Find' method. You'd have to write a custom look-up that loops through the data. Could be slow though if there are tens of thousands of rows
 

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,072
Office Version
365
Platform
Windows
Or have another field in the database which converts the various number combinations to exclude the spaces.
 

Watch MrExcel Video

Forum statistics

Threads
1,099,082
Messages
5,466,531
Members
406,484
Latest member
kaksolver

This Week's Hot Topics

Top