View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
pls123 pls123 is offline
external usenet poster
 
Posts: 121
Default little mistery..

my goal is tho have the cell with 0-1...


when i write this it doesn't work...

if "all my things happen" Then
aWS.Range("H11").Value = "1"
Else
aWS.Range("H11").Value = "0"
End If


when i write this it works!!

if "all my things happen" Then
aWS.Range("H9") = True
Else
aWS.Range("H9") = False
End If
If aWS.Range("H9") = True Then
aWS.Range("H11").Value = "1"
Else
aWS.Range("H11").Value = "0"
End If











"Joel" wrote:

Are you saying

aWS.Range("H9") = True
aWS.Range("H11").Value = aWS.Range("H9")

Were you expecting the results in H11 to be 1?

True and False in Basic are not stored as 1 and 0 like in some computer
languages.

It can be converted using Evaluate with this code. evaluate runs the code
as if it was on the worksheet.

Set aWS = ActiveSheet
aWS.Range("H9") = True
aWS.Range("H11").Value = Application.Evaluate("--(" & aWS.Name & "!H9)")

On the worksheet the -- converts True and False to 1 or 0.

This is equavalent to
aWS.Range("H11").Value = Application.Evaluate("--(sheet1!H9)")


"pls123" wrote:

this works........

If aWS.Range("D27").Value = "0" And aWS.Range("P2").Value = "1" And
aWS.Range("C10") = True And aWS.Range("C9") = True And aWS.Range("G9") = True
And aWS.Range("G13") = True And aWS.Range("G2").Value < "0" And
aWS.Range("N1").Value = "1" And aWS.Range("R12").Value
aWS.Range("N2").Value Then
aWS.Range("H9") = True
Else
aWS.Range("H9") = False
End If

If aWS.Range("H9") = True Then
aWS.Range("H11").Value = "1"
Else
aWS.Range("H11").Value = "0"
End If

...............if i cut the H9 passage..and write directly H11 it dosn't
work , not writing 1 when it's the time !!!!!