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: 25
Default String compare doesn't compare?

-I have 2 columns each of which are formatted as TEXT, one on sheet2 and the
other on sheet1

-both have identical data (all numbers put in as strings)

-I loaded up the column on sheet2 with: sheet2.cells(k,1) = Textbox2

-I loaded up the column on sheet1 with: sheet1.cells(k,1) = instring (where
Dim instring as string)

-after this was done, I cycle through the columns comparing them with:

If Sheet1.Cells(row, C_CBib) = Sheet2.Cells(i, 1)

-for every row the above "if" is true as you would expect.

-if I M A N U A L L Y change one of the numbers in one column from say 4 to
4 on sheet2 (take 4 out and put it back in), then that row no longer
compares. With a breakpoint set at the above "if", it shows the following:

Sheet1.Cells(row, C_CBib) = 4 and Sheet2.Cells(i, 1) = "4" N O T E the
parens

-if I do this to the same number on sheet1, it does the same thing only the
parens jump sides.

A L S O :

-if I run through the whole column on sheet2 with the statement:
Sheet2.Cells(i, 1) = Cstr(Sheet2.Cells(i, 1) ), it does something to all the
values such that they A L L show "parens" now. When I do the same to sheet1,
they remain the same(NO parens).

I can fix the problem by changing the above "if" to:

If Cstr(1.Cells(row, C_CBib))= Sheet2.Cells(i, 1)

However, I would have to do things like this in probably a hundred different
places in the code. Doesn't seem to be a good fix to me. It seems to me
there is some other underlying problem that I am not aware of.

Anybody have any ideas??

Thanks!!


 
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
compare string HugeHard Excel Worksheet Functions 1 October 30th 08 04:59 AM
compare string to column asmenut Excel Programming 2 September 30th 05 08:04 PM
How to compare two columns for a specified string? jarski Excel Programming 5 July 6th 05 04:38 PM
Compare between String and Value using VBA coco Excel Programming 1 June 27th 05 10:42 PM
string compare with wildcards Marcus Hoffmann Excel Programming 0 April 26th 05 09:31 AM


All times are GMT +1. The time now is 06:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"