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
|