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: 148
Default If resulting in False when it is actually true

Below is a portion of some code I have.
It works fine up to the point that I have noted. When I step through this,
it works fine. Just before the step that I flagged below, I can use the
intermediate window to determine the value of u, cells(u+1,"aa"), and item:
?item
1
?cells(u+1, "aa").value
1
?u
1
The value in cell AA2 is 1.

Columns("aa:ad").NumberFormat = 0
On Error Resume Next
For Each cell In causecats
cats.Add cell.Value, Key:=cell.Text
Next
On Error GoTo 0
r = 0
For Each item In cats

Debug.Print item
r = r + 1
Cells(r + 1, "aa") = item

Cells(r + 1, "ab").Formula = "=sumproduct((" & causecats.Address & "=""" & _
Cells(r + 1, "aa") & """)*(" & causebase.Address & "))"
Next

On Error Resume Next
For Each cell In causecats
revcats.Add cell.Value, Key:=cell.Text
Next
On Error GoTo 0
r = 0
j = 0
For Each item In revcats

Debug.Print item
r = r + 1
gFound = False
u = 0
For u = 1 To (causecats.Count + revcats.Count) * 2

'the result of the following line is false. I do not know why.

If item = Cells(u + 1, "aa") Then
Cells(u + 1, "ad").Formula = "=sumproduct((" & causecats.Address & "="""
& _
Cells(u + 1, "aa") & """)*(" & causerev.Address & "))"
gFound = True
Exit For
End If
Next


Do I have some syntax problem? formatting problem? If item=1, cell AA2 =1,
and u=1, I do not understand why result of If item = Cells(u + 1, "aa") is
false.

TIA for any ideas.
 
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
What's the best way to toggle between true and false in Excel? Hiall, My excel work involves a lot of toggling between true and false (booleantypes) ... and it's very repetitive... Is there a way to select a bunch ofcells, and press a key short-cu LunaMoon Excel Discussion (Misc queries) 9 July 29th 08 12:28 AM
Search for 2 true arguments and return true or false David Excel Discussion (Misc queries) 3 July 15th 06 10:18 AM
Function to return True/False if all are validated as True by ISNU Tetsuya Oguma Excel Worksheet Functions 2 March 15th 06 10:28 AM
Reverse false and combine with true true value Emmie99 Excel Worksheet Functions 5 August 17th 05 04:38 PM
True Or False, no matter what... it still displays the false statement rocky640[_2_] Excel Programming 2 May 13th 04 04:57 PM


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