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

I'm new to Macro's in Excel - but trainable

If cell xx has "AA" - I want to print range1 and range2
If cell xx has "BB" - I want to print range3 and range4
If cell xx has "CC" - I want to print range5 and range6

I would like to have a button that says "print" when the user is ready

How do I do this?

Thanks in advance for helping


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Conditional Print Macro

First, if you print discontiguous ranges, you'll get at least two sheets of
paper from your printer.

Option Explicit
Sub testme01()

With ActiveSheet
Select Case UCase(.Range("a1").Value)
Case Is = "AA"
.Range("a1:b9,e12:f13").PrintOut preview:=True
Case Is = "BB"
.Range("a2:b33,e33:f33").PrintOut preview:=True
Case Is = "BB"
.Range("a3:b21,e22:f23").PrintOut preview:=True
Case Else
MsgBox "what should happen here?"
End Select
End With

End Sub

Brad wrote:

I'm new to Macro's in Excel - but trainable

If cell xx has "AA" - I want to print range1 and range2
If cell xx has "BB" - I want to print range3 and range4
If cell xx has "CC" - I want to print range5 and range6

I would like to have a button that says "print" when the user is ready

How do I do this?

Thanks in advance for helping


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Conditional Print Macro

Ps. Put a button from the Forms toolbar on that worksheet. Make the caption
"Print" and assign that macro to that button.

Brad wrote:

I'm new to Macro's in Excel - but trainable

If cell xx has "AA" - I want to print range1 and range2
If cell xx has "BB" - I want to print range3 and range4
If cell xx has "CC" - I want to print range5 and range6

I would like to have a button that says "print" when the user is ready

How do I do this?

Thanks in advance for helping


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Conditional Print Macro

Thank you for your help.

Since the ranges that I was going to print weren't on the active worksheet -
I removed the period in front of the range command and got it to work. Is
that the proper way to do it - or did I just get lucky. The comma between
print ranges didn't work for me - I had to split it between two lines (is
that because the ranges were full pages?)

Got the button to work - pretty slick

Thanks again!


"Dave Peterson" wrote:

First, if you print discontiguous ranges, you'll get at least two sheets of
paper from your printer.

Option Explicit
Sub testme01()

With ActiveSheet
Select Case UCase(.Range("a1").Value)
Case Is = "AA"
.Range("a1:b9,e12:f13").PrintOut preview:=True
Case Is = "BB"
.Range("a2:b33,e33:f33").PrintOut preview:=True
Case Is = "BB"
.Range("a3:b21,e22:f23").PrintOut preview:=True
Case Else
MsgBox "what should happen here?"
End Select
End With

End Sub

Brad wrote:

I'm new to Macro's in Excel - but trainable

If cell xx has "AA" - I want to print range1 and range2
If cell xx has "BB" - I want to print range3 and range4
If cell xx has "CC" - I want to print range5 and range6

I would like to have a button that says "print" when the user is ready

How do I do this?

Thanks in advance for helping


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Conditional Print Macro





*** Sent via Developersdex http://www.developersdex.com ***
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
Pivot Table macro to set print area and print details of drill down data Steve Haskins Excel Discussion (Misc queries) 2 December 28th 05 04:59 PM
Macro to open print window and set to print entire workbook retseort Excel Discussion (Misc queries) 1 October 27th 05 11:00 PM
Create a print macro that would automatically select print area? wastedwings Excel Worksheet Functions 7 August 22nd 05 10:36 PM
Why does macro speed slow after Excel Print or Print Preview? Larry A[_3_] Excel Programming 6 May 16th 05 11:22 AM
Need Help w/ Print Macro to Print All Visible Sheets (including Charts) in a Workbook will Excel Programming 3 September 23rd 04 08:05 PM


All times are GMT +1. The time now is 12:49 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"