For Each minor problem
yes, rick, that was it - in a way....... you were correct in that the
textbox value was not exactly maching the cell.value, but it wasn't
because of decimals because they were both whole numbers. but after
staring at it long enough it finally penetrated that there was an
extra space in the cell.value. so the cell.value was " 1" and the
textbox.value was "1". so i added another line:
SusanBook = str(cell.Value)
SusanBook = trim(SusanBook) 'added line
that finally took care of the problem.
many thanks to everybody!
:D
susan
On Dec 31, 12:56*pm, "Rick Rothstein"
wrote:
You said in another subthread that the cells contain numbers... are those
cells formatted to show less decimal places than there actually are and are
you trying to compare a TextBox value that matches the formatted value
rather than the actual value in the cell? (If the cell is formatted, the
Value property returns the unformatted number that appears in the Formula
bar, not the value you see in the cell.)
--
Rick (MVP - Excel)
"Susan" wrote in message
...
i've done this kind of thing a thousand times, but i can't get this
one to work.........
'===========================
Dim cell as Range
myLastSusanRow = ws3.Cells(10000, 1).End(xlUp).Row + 1
Set rSusan = ws3.Range("a2:a" & myLastSusanRow)
For Each cell In rSusan
* If cell.Value = Me.txtBook.Value Then
* * *'minor stuff
*Else
* 'do nothing
* End If
Next cell
'=========================
the intellisense will give me the correct information for
me.txtBook.Value, but gives me nothing for cell.value. *i've tried
cell.text, that does nothing. *the intellisense only works if i just
use "cell", but the comparison doesn't work. *i've put in a
msgbox cell.value
test and that gives me the correct information.
the cell range is on Sheet3, and the txtBook textbox is on Sheet2.
the code is held in the Sheet2 area, not in a general module. *i'm
using XP 2000xl.
i know it's something minor & stupid, but what am i doing wrong?
thanks in advance!
:)
susan- Hide quoted text -
- Show quoted text -
|