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


Hi,

If Cell A1 = 1 ,Print Area (A2:M6)
If Cell A1 = 2, Print Area (A2:M11)
If Cell A1 = 3, Print Area(A2:M16) ... and so on

How do i write a vb to solve it.

Thanks in advance.

Raymond

Note : I wrongly post this question in tips and tutoria

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default conditional printing

Sub SetPrintArea()
Select Case Range("A1")
Case 0
ActiveSheet.PageSetup.PrintArea = ""
Case 1
ActiveSheet.PageSetup.PrintArea = "$A$1:$F$15"
Case 2
ActiveSheet.PageSetup.PrintArea = "$J$1:$K$15"
Case 3
Case Else
End Select

End Sub

Patrick Molloy
Microsoft Excel MVP

-----Original Message-----

Hi,

If Cell A1 = 1 ,Print Area (A2:M6)
If Cell A1 = 2, Print Area (A2:M11)
If Cell A1 = 3, Print Area(A2:M16) ... and so on

How do i write a vb to solve it.

Thanks in advance.

Raymond

Note : I wrongly post this question in tips and tutorial


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default conditional printing


Patrick,

Thank you for your reply. It works.

Would you mind tell me how to write another vb to shorten the length of
programming because number of 'Case' will be more than 100.

Raymond


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default conditional printing

Raymond,

Try

ActiveSheet.PageSetup.PrintArea = _
"A2:" & Cells(1 + (Range("A1").Value * 5), "M").Address


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"raymondsum" wrote in
message ...

Hi,

If Cell A1 = 1 ,Print Area (A2:M6)
If Cell A1 = 2, Print Area (A2:M11)
If Cell A1 = 3, Print Area(A2:M16) ... and so on

How do i write a vb to solve it.

Thanks in advance.

Raymond

Note : I wrongly post this question in tips and tutorial


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default conditional printing


It works. Thank you very much.

Raymon

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
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 Formatting and Printing Jay Fincannon Excel Worksheet Functions 4 October 9th 08 01:57 AM
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


All times are GMT +1. The time now is 07:05 AM.

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

About Us

"It's about Microsoft Excel"