ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   little mistery.. (https://www.excelbanter.com/excel-programming/417439-little-mistery.html)

pls123

little mistery..
 
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 !!!!!

joel

little mistery..
 
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 !!!!!


pls123

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


pls123

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




"pls123" wrote:

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


joel

little mistery..
 
This would work

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


Where Mytruth equals either True or false.

"pls123" wrote:

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




"pls123" wrote:

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


pls123

little mistery..
 
ty joel i will work on it

"Joel" wrote:

This would work

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


Where Mytruth equals either True or false.

"pls123" wrote:

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




"pls123" wrote:

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



All times are GMT +1. The time now is 12:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com