Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Set Print Area Macro
Hi All-
I am successfully using the below macro to define print area. The number of rows remains constant but the columns vary depending on the number of tests a person performs. The macro therefore will select and print the columns that are headed in row A. The row A headers are linked to other cells in the workbook that define a date. Range("A1:Z51").Select ActiveSheet.PageSetup.PrintArea = "A1:OFFSET(A1,50,COUNTA (A1:Z1)-1)" this however relies on the cells in row A that are not wanted to be printed to be blank. I now want to fully automate the wookbook and the problem I have is now the cells in row A are linked to another cell (T4 in this instance) that calculates a date, so there is always text in the row A column headers. I have tried to use the following =IF (T2,T4,"") (where T2 is date of birth and T4 is calculated age) to make the cells in Row A appear blank if there is not date of birth present. However the COUNTA function obviously works on cells being totally blank (i.e. not containing formulas) so no longer serves the purpose. Has anyone got any ideas on how to alter the PrintArea macro to set based on whether a cell is displayign a value? Thanks (as always) for any help offered Best Wishes Paul p.s. apologies if this question appears twice. I thought I posted it before but can't find it anywhere!!!! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Set Print Area Macro
See other post.
Porky79 wrote: Hi All- I am successfully using the below macro to define print area. The number of rows remains constant but the columns vary depending on the number of tests a person performs. The macro therefore will select and print the columns that are headed in row A. The row A headers are linked to other cells in the workbook that define a date. Range("A1:Z51").Select ActiveSheet.PageSetup.PrintArea = "A1:OFFSET(A1,50,COUNTA (A1:Z1)-1)" this however relies on the cells in row A that are not wanted to be printed to be blank. I now want to fully automate the wookbook and the problem I have is now the cells in row A are linked to another cell (T4 in this instance) that calculates a date, so there is always text in the row A column headers. I have tried to use the following =IF (T2,T4,"") (where T2 is date of birth and T4 is calculated age) to make the cells in Row A appear blank if there is not date of birth present. However the COUNTA function obviously works on cells being totally blank (i.e. not containing formulas) so no longer serves the purpose. Has anyone got any ideas on how to alter the PrintArea macro to set based on whether a cell is displayign a value? Thanks (as always) for any help offered Best Wishes Paul p.s. apologies if this question appears twice. I thought I posted it before but can't find it anywhere!!!! -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to hide rows with a certain cell empty then set print area and print | Excel Programming | |||
Print area Macro | Excel Programming | |||
Macro - Set Print Area for Changing Data Area | Excel Programming | |||
Pivot Table macro to set print area and print details of drill down data | Excel Discussion (Misc queries) | |||
Create a print macro that would automatically select print area? | Excel Worksheet Functions |