searching cells for a string of text

  • Thread starter Thread starter reddog9069
  • Start date Start date
R

reddog9069

basically i am searching cells for a string of text.

Some of the cells have spaces before the string and some of them have
or 3 spaces between seperate words in the cell so it is hard to compar
for equality.

I cannot seem to get the Split() method to work when there is leadin
whitespace.

It seems to work fine otherwise.

Also I cannot get Trim() to work. No idea why.

May be I need to include some more references, but it is confusing m
greatly.

I am using office 2003 if that helps.

Any help would be greatly appreciated
 
Just a complete guess. Maybe your cells don't contain spaces. If you've copied
and pasted from a web page, maybe it's those non-breaking spaces (in HTML
speak).

Chip Pearson has a nice addin that can help you determine each character in a
cell:
http://www.cpearson.com/excel/CellView.htm

If it turns out that you have spaces (or those non-breaking spaces), David
McRitchie has some code that will help clean this junk up:

http://www.mvps.org/dmcritchie/excel/join.htm#trimall
(look for "Sub Trimall()")

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

====
If it's none of this stuff, you may want to post more details--samples of what
you're looking for and samples of what the cells contain.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top