Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print only columns (or ranges) that have at least one currency val
In my worksheet, I would always like to print Columns A-F and only the
individual columns in G-R that have at least one value (formatted as Currency). If a given column between G and R has just the text heading in rows 1 or 2 OR is blank (though preformatted for Currency), then I want to suppress printing that particular column. - I don't want to have to select the columns but would rather use VBA to check whether Currency values exist in a column ornamed range - I want whichever columns that meet the criterion to print as one continuous range Can anyone help? Thanks, cspowell100 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print only columns (or ranges) that have at least one currency val
Maybe something like.....
Sub PrintCurrencyColumns() For j = 7 to 18 bHide = True For i = 1 to 2 '(or 1 to Cells.SpecialCells(xlCellTypeLastCell).Row) If IsNumeric(Cells(i,j).Text) = False Then bHide = False Next i If bHide = True Then Columns(j).Hidden = True Next j 'code for printing here, don't remember offhand, but the 'macro recorder might help, maybe ActiveSheet.Print? Columns.Hidden = False End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print only columns (or ranges) that have at least one currency
Dave - This goes a long way toward solving theproblem, I'll tinker with it
and see how it goes... Thanks, cspowell100 "Dave B" wrote: Maybe something like..... Sub PrintCurrencyColumns() For j = 7 to 18 bHide = True For i = 1 to 2 '(or 1 to Cells.SpecialCells(xlCellTypeLastCell).Row) If IsNumeric(Cells(i,j).Text) = False Then bHide = False Next i If bHide = True Then Columns(j).Hidden = True Next j 'code for printing here, don't remember offhand, but the 'macro recorder might help, maybe ActiveSheet.Print? Columns.Hidden = False End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
COMBINING TWO COLUMNS THAT ARE CURRENCY | Excel Worksheet Functions | |||
Print Area ranges print on separate pages? | Excel Discussion (Misc queries) | |||
Adding currency broken in two columns? | Excel Worksheet Functions | |||
Print Ranges | Excel Programming |