ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If....Or Logic question (https://www.excelbanter.com/excel-programming/301521-if-logic-question.html)

Stuart[_5_]

If....Or Logic question
 
Here's the code:

If (Global_PrintZeroPages = False Or _
Global_PrintBlankPages = False) Then
If Not Pagevarr(i + 1).Offset(-1, £Col).Value _
"0.00" Then

GoTo Line200
End If
End If

The code should test the 2 'Global' variables (dimmed as
Boolean). If either are set to False, then it should look at
the value in the range Pagevarr(i + 1).Offset(-1, £Col).

If "Global_PrintZeroPages = False" is True then it should
test for the value "0.00". If "Global_PrintBlankPages = False"
is True, then it should check for an empty cell (ie no textual
nor numeric entry).

If either value meets the criteria, then GoTo Line200, else
continue the routine.

How do I achieve this please?

Regards.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.706 / Virus Database: 462 - Release Date: 14/06/2004



Tom Ogilvy

If....Or Logic question
 
A =Global_PrintZeroPages
B = Global_PrintBlankPages
C = Pagevarr(i + 1).Offset(-1, £Col).Value

if A and B then
' do nothing, both true
elseif Not A and B then
if c= 0 then goto Line200
elseif A and Not B then
if isempty(c) then goto Line200
else ' both are false
' do what
End if

--
Regards,
Tom Ogilvy



"Stuart" wrote in message
...
Here's the code:

If (Global_PrintZeroPages = False Or _
Global_PrintBlankPages = False) Then
If Not Pagevarr(i + 1).Offset(-1, £Col).Value _
"0.00" Then

GoTo Line200
End If
End If

The code should test the 2 'Global' variables (dimmed as
Boolean). If either are set to False, then it should look at
the value in the range Pagevarr(i + 1).Offset(-1, £Col).

If "Global_PrintZeroPages = False" is True then it should
test for the value "0.00". If "Global_PrintBlankPages = False"
is True, then it should check for an empty cell (ie no textual
nor numeric entry).

If either value meets the criteria, then GoTo Line200, else
continue the routine.

How do I achieve this please?

Regards.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.706 / Virus Database: 462 - Release Date: 14/06/2004





George Nicholson[_2_]

If....Or Logic question
 
Note: 2 possible approaches.

Approach1:
If (Global_PrintZeroPages = False) OR (Global_PrintBlankPages = False) Then
' If either is true, check Pagevarr for *Either* condition
Select Case Pagevarr(i + 1).Offset(-1, £Col).Value
Case Null
GoTo Line200
Case "0.00"
' Continue
Case Else
GoTo Line200
End Select
End If

Approach2:
' If individual statement is true, check Pagevar for specific condition
' Note: Is there any problem if we "GoTo Line 200" more than once? Any
chance we might?

If Global_PrintZeroPages = False Then
If Not Pagevarr(i + 1).Offset(-1, £Col).Value "0.00" Then
GoTo Line200
End If
End If

If Global_PrintBlankPages = False Then
If Len(Pagevarr(i + 1).Offset(-1, £Col).Value) = 0 Then
GoTo Line200
End If
End If


--
George Nicholson

Remove 'Junk' from return address.


"Stuart" wrote in message
...
Here's the code:

If (Global_PrintZeroPages = False Or _
Global_PrintBlankPages = False) Then
If Not Pagevarr(i + 1).Offset(-1, £Col).Value _
"0.00" Then

GoTo Line200
End If
End If

The code should test the 2 'Global' variables (dimmed as
Boolean). If either are set to False, then it should look at
the value in the range Pagevarr(i + 1).Offset(-1, £Col).

If "Global_PrintZeroPages = False" is True then it should
test for the value "0.00". If "Global_PrintBlankPages = False"
is True, then it should check for an empty cell (ie no textual
nor numeric entry).

If either value meets the criteria, then GoTo Line200, else
continue the routine.

How do I achieve this please?

Regards.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.706 / Virus Database: 462 - Release Date: 14/06/2004





Stuart[_5_]

If....Or Logic question
 
First time I think I've understood that.

Many thanks.

Regards.

"Tom Ogilvy" wrote in message
...
A =Global_PrintZeroPages
B = Global_PrintBlankPages
C = Pagevarr(i + 1).Offset(-1, £Col).Value

if A and B then
' do nothing, both true
elseif Not A and B then
if c= 0 then goto Line200
elseif A and Not B then
if isempty(c) then goto Line200
else ' both are false
' do what
End if

--
Regards,
Tom Ogilvy



"Stuart" wrote in message
...
Here's the code:

If (Global_PrintZeroPages = False Or _
Global_PrintBlankPages = False) Then
If Not Pagevarr(i + 1).Offset(-1, £Col).Value _
"0.00" Then

GoTo Line200
End If
End If

The code should test the 2 'Global' variables (dimmed as
Boolean). If either are set to False, then it should look at
the value in the range Pagevarr(i + 1).Offset(-1, £Col).

If "Global_PrintZeroPages = False" is True then it should
test for the value "0.00". If "Global_PrintBlankPages = False"
is True, then it should check for an empty cell (ie no textual
nor numeric entry).

If either value meets the criteria, then GoTo Line200, else
continue the routine.

How do I achieve this please?

Regards.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.706 / Virus Database: 462 - Release Date: 14/06/2004






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.706 / Virus Database: 462 - Release Date: 14/06/2004



Stuart[_5_]

If....Or Logic question
 
Many thanks.

' Note: Is there any problem if we "GoTo Line 200" more than once? Any
chance we might?


Printvarr effectively defines the Printareas in the sheet being processed
Pagevarr(i) holds the value (found in col A) that marks the start
of each 'page' to be printed. Thus Pagevarr(i + 1).Offset(-1, £Col).Value
can be used to find the 'Summary' value for that 'page'.
If user has not requested a print of zero or blank 'pages' then I need to
exclude the print (hence a "cop-out" to Line200) of this particular
printarea,
but continue the loop to consider other printareas (defined by the array
Printvarr).

For i = 1 To UBound(Printvarr)
If £Col = 14 And Columns(£Col).EntireColumn.Hidden _
= True Then
With Pagevarr(i + 1).Offset(-1, (£Col - 2))
.Value = "£"
End With
End If
If (Global_PrintZeroPages = False Or _
Global_PrintBlankPages = False) Then
If Not Pagevarr(i + 1).Offset(-1, £Col).Value _
"0.00" Then

GoTo Line200
End If
End If

'for testing, toggle as required
' Printvarr(i).PrintOut
Printvarr(i).PrintPreview
Line200:
Next

If I've missed anything in your post, then please educate.

Regards.


"George Nicholson" wrote in message
...
Note: 2 possible approaches.

Approach1:
If (Global_PrintZeroPages = False) OR (Global_PrintBlankPages = False)

Then
' If either is true, check Pagevarr for *Either* condition
Select Case Pagevarr(i + 1).Offset(-1, £Col).Value
Case Null
GoTo Line200
Case "0.00"
' Continue
Case Else
GoTo Line200
End Select
End If

Approach2:
' If individual statement is true, check Pagevar for specific

condition
' Note: Is there any problem if we "GoTo Line 200" more than once? Any
chance we might?

If Global_PrintZeroPages = False Then
If Not Pagevarr(i + 1).Offset(-1, £Col).Value "0.00" Then
GoTo Line200
End If
End If

If Global_PrintBlankPages = False Then
If Len(Pagevarr(i + 1).Offset(-1, £Col).Value) = 0 Then
GoTo Line200
End If
End If


--
George Nicholson

Remove 'Junk' from return address.


"Stuart" wrote in message
...
Here's the code:

If (Global_PrintZeroPages = False Or _
Global_PrintBlankPages = False) Then
If Not Pagevarr(i + 1).Offset(-1, £Col).Value _
"0.00" Then

GoTo Line200
End If
End If

The code should test the 2 'Global' variables (dimmed as
Boolean). If either are set to False, then it should look at
the value in the range Pagevarr(i + 1).Offset(-1, £Col).

If "Global_PrintZeroPages = False" is True then it should
test for the value "0.00". If "Global_PrintBlankPages = False"
is True, then it should check for an empty cell (ie no textual
nor numeric entry).

If either value meets the criteria, then GoTo Line200, else
continue the routine.

How do I achieve this please?

Regards.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.706 / Virus Database: 462 - Release Date: 14/06/2004






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.706 / Virus Database: 462 - Release Date: 14/06/2004




All times are GMT +1. The time now is 11:59 PM.

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