![]() |
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 |
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 |
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 |
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 |
Conditional Print Macro
|
All times are GMT +1. The time now is 01:19 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com