little mistery..

P

pls123

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 !!!!!
 
J

Joel

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)")
 
P

pls123

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
 
P

pls123

i dont use anymore 1-0 but only true-false..but the mistery is still alive !!
bbyyyy
 
J

Joel

This would work

MyTruth = "all my things happen"
aWS.Range("H11").Value = evaluate("--("&MyTruth&")")


Where Mytruth equals either True or false.
 
P

pls123

ty joel i will work on it

Joel said:
This would work

MyTruth = "all my things happen"
aWS.Range("H11").Value = evaluate("--("&MyTruth&")")


Where Mytruth equals either True or false.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top