Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 30
Default conditional printing? macro?

here's my situation, i have a workbook with many sheets in it, each sheet if
the default print shortcut button was used would print to 4 pages of A4
paper.

the data on these sheets varies everyday, someday's only 1 page per sheet
would be full of data others 2, 3, or 4 etc. how could i write a macro that
would be able to print only the needed pages?, each page, if it contains any
data would have a value in a totals cell.

so i would need code along these lines

Sheets("sheet1").Select
IF(OR(total1="",total1=0),"don't print","don't print") ELSE set data1 = TRUE
IF(OR(total2="",total2=0),"don't print","don't print") ELSE set data2 = TRUE
IF(OR(total3="",total3=0),"don't print","don't print") ELSE set data3 = TRUE
IF(OR(total4="",total4=0),"don't print","don't print") ELSE set data4 = TRUE

IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 1", "don't print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 2", "don't print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 3", "don't print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 4", "don't print")

Hope this helps to explain what im trying to do, and someone is able to code
something that would work.

Many thanks,
Steve


  #2   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,123
Default conditional printing? macro?

Hi Steven

Try this

Sub test()
If Range("total1") 0 Then ActiveSheet.PrintOut From:=1, To:=1
If Range("total2") 0 Then ActiveSheet.PrintOut From:=2, To:=2
If Range("total3") 0 Then ActiveSheet.PrintOut From:=3, To:=3
If Range("total4") 0 Then ActiveSheet.PrintOut From:=4, To:=4
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steven" wrote in message news:kELoc.118$6X5.92@newsfe1-win...
here's my situation, i have a workbook with many sheets in it, each sheet if
the default print shortcut button was used would print to 4 pages of A4
paper.

the data on these sheets varies everyday, someday's only 1 page per sheet
would be full of data others 2, 3, or 4 etc. how could i write a macro that
would be able to print only the needed pages?, each page, if it contains any
data would have a value in a totals cell.

so i would need code along these lines

Sheets("sheet1").Select
IF(OR(total1="",total1=0),"don't print","don't print") ELSE set data1 = TRUE
IF(OR(total2="",total2=0),"don't print","don't print") ELSE set data2 = TRUE
IF(OR(total3="",total3=0),"don't print","don't print") ELSE set data3 = TRUE
IF(OR(total4="",total4=0),"don't print","don't print") ELSE set data4 = TRUE

IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 1", "don't print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 2", "don't print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 3", "don't print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 4", "don't print")

Hope this helps to explain what im trying to do, and someone is able to code
something that would work.

Many thanks,
Steve




  #3   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 30
Default conditional printing? macro?

Thanks Ron,
how could i test this without printing? if possible?

Steve

"Ron de Bruin" wrote in message
...
Hi Steven

Try this

Sub test()
If Range("total1") 0 Then ActiveSheet.PrintOut From:=1, To:=1
If Range("total2") 0 Then ActiveSheet.PrintOut From:=2, To:=2
If Range("total3") 0 Then ActiveSheet.PrintOut From:=3, To:=3
If Range("total4") 0 Then ActiveSheet.PrintOut From:=4, To:=4
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steven" wrote in message

news:kELoc.118$6X5.92@newsfe1-win...
here's my situation, i have a workbook with many sheets in it, each

sheet if
the default print shortcut button was used would print to 4 pages of A4
paper.

the data on these sheets varies everyday, someday's only 1 page per

sheet
would be full of data others 2, 3, or 4 etc. how could i write a macro

that
would be able to print only the needed pages?, each page, if it contains

any
data would have a value in a totals cell.

so i would need code along these lines

Sheets("sheet1").Select
IF(OR(total1="",total1=0),"don't print","don't print") ELSE set data1 =

TRUE
IF(OR(total2="",total2=0),"don't print","don't print") ELSE set data2 =

TRUE
IF(OR(total3="",total3=0),"don't print","don't print") ELSE set data3 =

TRUE
IF(OR(total4="",total4=0),"don't print","don't print") ELSE set data4 =

TRUE

IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 1", "don't print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 2", "don't print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 3", "don't print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 4", "don't print")

Hope this helps to explain what im trying to do, and someone is able to

code
something that would work.

Many thanks,
Steve






  #4   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,123
Default conditional printing? macro?

Printpreview will not work with From:=1, To:=1

You must print

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steven" wrote in message ...
Thanks Ron,
how could i test this without printing? if possible?

Steve

"Ron de Bruin" wrote in message
...
Hi Steven

Try this

Sub test()
If Range("total1") 0 Then ActiveSheet.PrintOut From:=1, To:=1
If Range("total2") 0 Then ActiveSheet.PrintOut From:=2, To:=2
If Range("total3") 0 Then ActiveSheet.PrintOut From:=3, To:=3
If Range("total4") 0 Then ActiveSheet.PrintOut From:=4, To:=4
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steven" wrote in message

news:kELoc.118$6X5.92@newsfe1-win...
here's my situation, i have a workbook with many sheets in it, each

sheet if
the default print shortcut button was used would print to 4 pages of A4
paper.

the data on these sheets varies everyday, someday's only 1 page per

sheet
would be full of data others 2, 3, or 4 etc. how could i write a macro

that
would be able to print only the needed pages?, each page, if it contains

any
data would have a value in a totals cell.

so i would need code along these lines

Sheets("sheet1").Select
IF(OR(total1="",total1=0),"don't print","don't print") ELSE set data1 =

TRUE
IF(OR(total2="",total2=0),"don't print","don't print") ELSE set data2 =

TRUE
IF(OR(total3="",total3=0),"don't print","don't print") ELSE set data3 =

TRUE
IF(OR(total4="",total4=0),"don't print","don't print") ELSE set data4 =

TRUE

IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 1", "don't print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 2", "don't print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 3", "don't print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 4", "don't print")

Hope this helps to explain what im trying to do, and someone is able to

code
something that would work.

Many thanks,
Steve








  #5   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 24
Default conditional printing? macro?

How about instead of ActiveSheet.PrintOut set up a way to get the range for
the area to print and return it in a MsgBox?
or DeBug Print? or....

--
steveb
(Remove 'NOSPAM' from email address if replying direct)


"Ron de Bruin" wrote in message
...
Printpreview will not work with From:=1, To:=1

You must print

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steven" wrote in message

...
Thanks Ron,
how could i test this without printing? if possible?

Steve

"Ron de Bruin" wrote in message
...
Hi Steven

Try this

Sub test()
If Range("total1") 0 Then ActiveSheet.PrintOut From:=1, To:=1
If Range("total2") 0 Then ActiveSheet.PrintOut From:=2, To:=2
If Range("total3") 0 Then ActiveSheet.PrintOut From:=3, To:=3
If Range("total4") 0 Then ActiveSheet.PrintOut From:=4, To:=4
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steven" wrote in message

news:kELoc.118$6X5.92@newsfe1-win...
here's my situation, i have a workbook with many sheets in it, each

sheet if
the default print shortcut button was used would print to 4 pages of

A4
paper.

the data on these sheets varies everyday, someday's only 1 page per

sheet
would be full of data others 2, 3, or 4 etc. how could i write a

macro
that
would be able to print only the needed pages?, each page, if it

contains
any
data would have a value in a totals cell.

so i would need code along these lines

Sheets("sheet1").Select
IF(OR(total1="",total1=0),"don't print","don't print") ELSE set

data1 =
TRUE
IF(OR(total2="",total2=0),"don't print","don't print") ELSE set

data2 =
TRUE
IF(OR(total3="",total3=0),"don't print","don't print") ELSE set

data3 =
TRUE
IF(OR(total4="",total4=0),"don't print","don't print") ELSE set

data4 =
TRUE

IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 1", "don't

print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 2", "don't

print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 3", "don't

print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 4", "don't

print")

Hope this helps to explain what im trying to do, and someone is able

to
code
something that would work.

Many thanks,
Steve












  #6   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,824
Default conditional printing? macro?

Or maybe:

Option Explicit
Sub test()
If Range("total1") 0 Then ActiveSheet.PrintOut preview:=True, From:=1, To:=1
If Range("total2") 0 Then ActiveSheet.PrintOut preview:=True, From:=2, To:=2
If Range("total3") 0 Then ActiveSheet.PrintOut preview:=True, From:=3, To:=3
If Range("total4") 0 Then ActiveSheet.PrintOut preview:=True, From:=4, To:=4
End Sub

it worked ok for me in xl2002.




steveb wrote:

How about instead of ActiveSheet.PrintOut set up a way to get the range for
the area to print and return it in a MsgBox?
or DeBug Print? or....

--
steveb
(Remove 'NOSPAM' from email address if replying direct)

"Ron de Bruin" wrote in message
...
Printpreview will not work with From:=1, To:=1

You must print

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steven" wrote in message

...
Thanks Ron,
how could i test this without printing? if possible?

Steve

"Ron de Bruin" wrote in message
...
Hi Steven

Try this

Sub test()
If Range("total1") 0 Then ActiveSheet.PrintOut From:=1, To:=1
If Range("total2") 0 Then ActiveSheet.PrintOut From:=2, To:=2
If Range("total3") 0 Then ActiveSheet.PrintOut From:=3, To:=3
If Range("total4") 0 Then ActiveSheet.PrintOut From:=4, To:=4
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steven" wrote in message
news:kELoc.118$6X5.92@newsfe1-win...
here's my situation, i have a workbook with many sheets in it, each
sheet if
the default print shortcut button was used would print to 4 pages of

A4
paper.

the data on these sheets varies everyday, someday's only 1 page per
sheet
would be full of data others 2, 3, or 4 etc. how could i write a

macro
that
would be able to print only the needed pages?, each page, if it

contains
any
data would have a value in a totals cell.

so i would need code along these lines

Sheets("sheet1").Select
IF(OR(total1="",total1=0),"don't print","don't print") ELSE set

data1 =
TRUE
IF(OR(total2="",total2=0),"don't print","don't print") ELSE set

data2 =
TRUE
IF(OR(total3="",total3=0),"don't print","don't print") ELSE set

data3 =
TRUE
IF(OR(total4="",total4=0),"don't print","don't print") ELSE set

data4 =
TRUE

IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 1", "don't

print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 2", "don't

print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 3", "don't

print")
IF(OR(data1 ="TRUE",data1="FALSE"),"Print Page 1 to 4", "don't

print")

Hope this helps to explain what im trying to do, and someone is able

to
code
something that would work.

Many thanks,
Steve









--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
conditional formatting and printing snazzy Excel Discussion (Misc queries) 2 November 2nd 09 06:34 PM
conditional printing Conditional printing Excel Discussion (Misc queries) 4 September 15th 08 01:51 PM
Conditional Printing James[_4_] Excel Discussion (Misc queries) 1 July 24th 07 10:45 PM
Printing conditional images Trav Excel Discussion (Misc queries) 6 January 12th 06 02:46 AM
conditional printing raymondsum[_9_] Excel Programming 4 December 3rd 03 02:24 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"