If Select is the solution - how to avoid Select

If Select is the solution - how to avoid Select

Post by Stuar » Sat, 22 May 2004 03:31:17


I'm looping through workbooks, establishing ranges then
printing them, but only if a 'total' is neither blank or zero.
I have:
For i = 1 To UBound(Printvarr)
If Not (IsEmpty(Pagevarr(i + 1).Offset(-1, ol)) Or _
IsEmpty(Pagevarr(i + 1).Offset(-1, ol)) _
Or Pagevarr(i + 1).Offset(-1, ol).Value _
= "0.00") Then
'for testing ... toggle as required
Printvarr(i).PrintPreview
Printvarr(i).PrintOut
End If
Next

This code seems to print all ranges correctly, but includes
zero and blank pages.

If I say:

For i = 1 To UBound(Printvarr)
ws.Activate
Pagevarr(i + 1).Offset(-1, ol).Select
If Not (IsEmpty(Pagevarr(i + 1).Offset(-1, ol)) Or _
IsEmpty(Pagevarr(i + 1).Offset(-1, ol)) _
Or Pagevarr(i + 1).Offset(-1, ol).Value _
= "0.00") Then
'for testing ... toggle as required
Printvarr(i).PrintPreview
Printvarr(i).PrintOut
End If
Next

Now it seems to exclude empty and zero pages.

If I'm right, then how to Select, please?

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( http://www.yqcomputer.com/ ).
Version: 6.0.688 / Virus Database: 449 - Release Date: 18/05/2004
 
 
 

If Select is the solution - how to avoid Select

Post by Y2hyaX » Sat, 22 May 2004 05:06:11


If I'm right, then how to Select, please
Select What

 
 
 

If Select is the solution - how to avoid Select

Post by Stuar » Sat, 22 May 2004 05:49:53

Ooops.
try

If I'm right, then how to AVOID the ws.Activate and
Cell Selection, please?

Regards.






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( http://www.yqcomputer.com/ ).
Version: 6.0.688 / Virus Database: 449 - Release Date: 18/05/2004
 
 
 

If Select is the solution - how to avoid Select

Post by Doug Glanc » Sat, 22 May 2004 05:57:27

Stuart,

I think you need to qualify PageVarr with the worksheet name, e.g.,

ws.PageVarr

Otherwise the code is looking at the PageVarr range on the active sheet. At
least, that's what I think is going on.

hth,

Doug Glancy