Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 12
Default Problem Spaces

Hi,
I'm comparing the string values in a column of Dealer Names to those stored
in an Array of Dealer Names.
My code isn't finding any matches (although there are plenty) & I think it
is something to do with this;

When debug it & step through, I notice that the value of the string in my
array looks something like this;

"Joe Bloggs & Sons Ltd"

but the variable is returning Dealer names from the column that look
something like this;

"Joe Bloggs & Sons Ltd "

I'm guessing the amount spaces between the last letter of the string & the
quotation mark is why no matches
are being found. How can I solve this please,

"MERRY
XMAS EVERYONE ! " :-)


  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 12
Default Problem Spaces

Think I've sorted it. Trim? It worked so I guess it must be the correct
solution?

"egibberate" wrote in message
...
Hi,
I'm comparing the string values in a column of Dealer Names to those
stored in an Array of Dealer Names.
My code isn't finding any matches (although there are plenty) & I think it
is something to do with this;

When debug it & step through, I notice that the value of the string in my
array looks something like this;

"Joe Bloggs & Sons Ltd"

but the variable is returning Dealer names from the column that look
something like this;

"Joe Bloggs & Sons Ltd "

I'm guessing the amount spaces between the last letter of the string & the
quotation mark is why no matches
are being found. How can I solve this please,

"MERRY
XMAS EVERYONE ! " :-)



  #3   Report Post  
Posted to microsoft.public.excel.newusers
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Problem Spaces

Yep. The VBA Trim function will remove the leading and trailing spaces. If
you ever have any problems w/ extra spaces between the words, such as

"Joe Bloggs & Sons Ltd"

you could use Application.Trim, which is the excel worksheet function
version that removes all extra spaces (not just the leading and trailing
spaces like the VBA version).


"egibberate" wrote:

Think I've sorted it. Trim? It worked so I guess it must be the correct
solution?

"egibberate" wrote in message
...
Hi,
I'm comparing the string values in a column of Dealer Names to those
stored in an Array of Dealer Names.
My code isn't finding any matches (although there are plenty) & I think it
is something to do with this;

When debug it & step through, I notice that the value of the string in my
array looks something like this;

"Joe Bloggs & Sons Ltd"

but the variable is returning Dealer names from the column that look
something like this;

"Joe Bloggs & Sons Ltd "

I'm guessing the amount spaces between the last letter of the string & the
quotation mark is why no matches
are being found. How can I solve this please,

"MERRY
XMAS EVERYONE ! " :-)




  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 12
Default Problem Spaces

Thanks for your response JMB.

"JMB" wrote in message
...
Yep. The VBA Trim function will remove the leading and trailing spaces.
If
you ever have any problems w/ extra spaces between the words, such as

"Joe Bloggs & Sons Ltd"

you could use Application.Trim, which is the excel worksheet function
version that removes all extra spaces (not just the leading and trailing
spaces like the VBA version).


"egibberate" wrote:

Think I've sorted it. Trim? It worked so I guess it must be the correct
solution?

"egibberate" wrote in message
...
Hi,
I'm comparing the string values in a column of Dealer Names to those
stored in an Array of Dealer Names.
My code isn't finding any matches (although there are plenty) & I think
it
is something to do with this;

When debug it & step through, I notice that the value of the string in
my
array looks something like this;

"Joe Bloggs & Sons Ltd"

but the variable is returning Dealer names from the column that look
something like this;

"Joe Bloggs & Sons Ltd "

I'm guessing the amount spaces between the last letter of the string &
the
quotation mark is why no matches
are being found. How can I solve this please,


"MERRY
XMAS EVERYONE ! " :-)






  #5   Report Post  
Posted to microsoft.public.excel.newusers
CLR CLR is offline
external usenet poster
 
Posts: 594
Default Problem Spaces

The ASAP Utilities add-in, available free at www.asap-utilities.com has
features that are very helpful in cleaning up text.........they can delete
unwanted spaces, and other selected characters on demand.

Vaya con Dios,
chuck, CABGx3


"egibberate" wrote in message
...
Think I've sorted it. Trim? It worked so I guess it must be the correct
solution?

"egibberate" wrote in message
...
Hi,
I'm comparing the string values in a column of Dealer Names to those
stored in an Array of Dealer Names.
My code isn't finding any matches (although there are plenty) & I think

it
is something to do with this;

When debug it & step through, I notice that the value of the string in

my
array looks something like this;

"Joe Bloggs & Sons Ltd"

but the variable is returning Dealer names from the column that look
something like this;

"Joe Bloggs & Sons Ltd "

I'm guessing the amount spaces between the last letter of the string &

the
quotation mark is why no matches
are being found. How can I solve this please,


"MERRY
XMAS EVERYONE ! " :-)





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
Importing from Excel Sheet Problem workerboy Excel Discussion (Misc queries) 0 August 18th 06 02:44 PM
Add spaces for specific fields to paste in Corey Excel Discussion (Misc queries) 3 December 30th 05 10:22 PM
how do I remove empty spaces trailing a text string? Need_Help Excel Worksheet Functions 2 June 7th 05 12:13 AM
Stripping out imbedded spaces in a cell/row Tom Excel Worksheet Functions 8 April 22nd 05 03:49 PM
remove spaces in text in excel GnarlyCar Excel Discussion (Misc queries) 3 February 1st 05 05:02 PM


All times are GMT +1. The time now is 07:18 PM.

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"