From: pls123 on
hello all!!
any reason why this should not work correctly ? ;)))
tx !!!


If aWS.Range("M52").Value = True Then
aWS.Range("M80").Value = 5
Else
If aWS.Range("M51").Value = True Then
aWS.Range("M80").Value = 4
Else
If aWS.Range("M50").Value = True Then
aWS.Range("M80").Value = 3
Else
If aWS.Range("M49").Value = True Then
aWS.Range("M80").Value = 2
Else
If aWS.Range("M48").Value = True Then
aWS.Range("M80").Value = 1
End If
End If
End If
End If
End If
From: Mike H on
Hi,

Well it's doing exactly what your telling it to do:

Check in turn M52, M51, M50, M49 & M48 of whatever aWs is and as soon as 1
of those tests evaluates as TRUE put a number in M80.

You must be aware that as soon as a condition has evaluated as TRUE then
none of the following tests execute

so the real question is what do you want it to do?
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"pls123" wrote:

> hello all!!
> any reason why this should not work correctly ? ;)))
> tx !!!
>
>
> If aWS.Range("M52").Value = True Then
> aWS.Range("M80").Value = 5
> Else
> If aWS.Range("M51").Value = True Then
> aWS.Range("M80").Value = 4
> Else
> If aWS.Range("M50").Value = True Then
> aWS.Range("M80").Value = 3
> Else
> If aWS.Range("M49").Value = True Then
> aWS.Range("M80").Value = 2
> Else
> If aWS.Range("M48").Value = True Then
> aWS.Range("M80").Value = 1
> End If
> End If
> End If
> End If
> End If
From: pls123 on
hi mike !!
the problem is that..
i changed the raws of sub like i showed before..
...to make it more efficient for cpu..
but it doesn't write the number !!!

before it was without the else...
like ths..

if 48 true then 1 end if
if 49 true then 2 end if
.....etc ..etc...


i have no idea..!
paolo






"Mike H" wrote:

> Hi,
>
> Well it's doing exactly what your telling it to do:
>
> Check in turn M52, M51, M50, M49 & M48 of whatever aWs is and as soon as 1
> of those tests evaluates as TRUE put a number in M80.
>
> You must be aware that as soon as a condition has evaluated as TRUE then
> none of the following tests execute
>
> so the real question is what do you want it to do?
> --
> Mike
>
> When competing hypotheses are otherwise equal, adopt the hypothesis that
> introduces the fewest assumptions while still sufficiently answering the
> question.
>
>
> "pls123" wrote:
>
> > hello all!!
> > any reason why this should not work correctly ? ;)))
> > tx !!!
> >
> >
> > If aWS.Range("M52").Value = True Then
> > aWS.Range("M80").Value = 5
> > Else
> > If aWS.Range("M51").Value = True Then
> > aWS.Range("M80").Value = 4
> > Else
> > If aWS.Range("M50").Value = True Then
> > aWS.Range("M80").Value = 3
> > Else
> > If aWS.Range("M49").Value = True Then
> > aWS.Range("M80").Value = 2
> > Else
> > If aWS.Range("M48").Value = True Then
> > aWS.Range("M80").Value = 1
> > End If
> > End If
> > End If
> > End If
> > End If
From: pls123 on

sorry mike there was another error !!!!!!

i have 2 different pages..
in 1 kind all those cells are empty..

realy very sorry for the disturb !
paolo



"pls123" wrote:

> hi mike !!
> the problem is that..
> i changed the raws of sub like i showed before..
> ..to make it more efficient for cpu..
> but it doesn't write the number !!!
>
> before it was without the else...
> like ths..
>
> if 48 true then 1 end if
> if 49 true then 2 end if
> ....etc ..etc...
>
>
> i have no idea..!
> paolo
>
>
>
>
>
>
> "Mike H" wrote:
>
> > Hi,
> >
> > Well it's doing exactly what your telling it to do:
> >
> > Check in turn M52, M51, M50, M49 & M48 of whatever aWs is and as soon as 1
> > of those tests evaluates as TRUE put a number in M80.
> >
> > You must be aware that as soon as a condition has evaluated as TRUE then
> > none of the following tests execute
> >
> > so the real question is what do you want it to do?
> > --
> > Mike
> >
> > When competing hypotheses are otherwise equal, adopt the hypothesis that
> > introduces the fewest assumptions while still sufficiently answering the
> > question.
> >
> >
> > "pls123" wrote:
> >
> > > hello all!!
> > > any reason why this should not work correctly ? ;)))
> > > tx !!!
> > >
> > >
> > > If aWS.Range("M52").Value = True Then
> > > aWS.Range("M80").Value = 5
> > > Else
> > > If aWS.Range("M51").Value = True Then
> > > aWS.Range("M80").Value = 4
> > > Else
> > > If aWS.Range("M50").Value = True Then
> > > aWS.Range("M80").Value = 3
> > > Else
> > > If aWS.Range("M49").Value = True Then
> > > aWS.Range("M80").Value = 2
> > > Else
> > > If aWS.Range("M48").Value = True Then
> > > aWS.Range("M80").Value = 1
> > > End If
> > > End If
> > > End If
> > > End If
> > > End If
From: Mike H on
Hi,

> if 48 true then 1 end if
> if 49 true then 2 end if

Is a completely different structure. Doing it that that way each of the IF's
will execute even if the first was TRUE so if they are all TRUE that value in
M80 will be the result of the last if statement.

I'm no clearer on what the problem is, the code from your first post works
perfectly for me. If for example we have the following set of conditions

M52=FALSE
M51=FALSE
M50=TRUE
M49=TRUE
M48=TRUE

then the value in M80 will be 3 and M49 & M48 will not be tested. So for the
above set of conditions what result would you expect? What is Aws?
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"pls123" wrote:

> hi mike !!
> the problem is that..
> i changed the raws of sub like i showed before..
> ..to make it more efficient for cpu..
> but it doesn't write the number !!!
>
> before it was without the else...
> like ths..
>
> if 48 true then 1 end if
> if 49 true then 2 end if
> ....etc ..etc...
>
>
> i have no idea..!
> paolo
>
>
>
>
>
>
> "Mike H" wrote:
>
> > Hi,
> >
> > Well it's doing exactly what your telling it to do:
> >
> > Check in turn M52, M51, M50, M49 & M48 of whatever aWs is and as soon as 1
> > of those tests evaluates as TRUE put a number in M80.
> >
> > You must be aware that as soon as a condition has evaluated as TRUE then
> > none of the following tests execute
> >
> > so the real question is what do you want it to do?
> > --
> > Mike
> >
> > When competing hypotheses are otherwise equal, adopt the hypothesis that
> > introduces the fewest assumptions while still sufficiently answering the
> > question.
> >
> >
> > "pls123" wrote:
> >
> > > hello all!!
> > > any reason why this should not work correctly ? ;)))
> > > tx !!!
> > >
> > >
> > > If aWS.Range("M52").Value = True Then
> > > aWS.Range("M80").Value = 5
> > > Else
> > > If aWS.Range("M51").Value = True Then
> > > aWS.Range("M80").Value = 4
> > > Else
> > > If aWS.Range("M50").Value = True Then
> > > aWS.Range("M80").Value = 3
> > > Else
> > > If aWS.Range("M49").Value = True Then
> > > aWS.Range("M80").Value = 2
> > > Else
> > > If aWS.Range("M48").Value = True Then
> > > aWS.Range("M80").Value = 1
> > > End If
> > > End If
> > > End If
> > > End If
> > > End If