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: 13
Default Cell search, match part of string

I've got two spreadsheets that have a column with the same data, more or less.
i.e. spreadsheet 1 has "Gloucester" and the spreadsheet 2 "Gloucester "

so i've got this bit of macro
where sitename comes from spreadsheet 1 and is a string and
osheet.Range("A" & counter) comes from spreadsheet 2.

For counter = 1 To 50 Step 1

If sitename = osheet.Range("A" & counter) Then

do stuff

Next counter

The problem is that with the example above, i.e. spreadsheet 1 has
"Gloucester" and the spreadsheet 2 "Gloucester ", the if will never be true

Is there any way of getting around this.

Maybe removing the empty spaces at the end of a cell?

TIA
 
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
Search/Match/Find ANY part of string to ANY part of Cell Value TWhizTom Excel Worksheet Functions 0 July 21st 08 08:16 PM
search value as part of a cell value Nogi Excel Programming 0 June 21st 06 07:54 AM
Move Part of Cell String tom[_7_] Excel Programming 8 October 13th 05 06:37 PM
select part of a cell value string rich_j_h Excel Discussion (Misc queries) 2 May 19th 05 11:36 AM
Search on a part of the cell value Syrus the Virus[_7_] Excel Programming 0 January 22nd 04 01:02 PM


All times are GMT +1. The time now is 10:36 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"