Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hello,
Somebody can help me ? I need a macro that hide all the columns from column C till the last used column where no data is registrated in recordnr 2. Remarks..... in record nr.2, in all the columns, a formula is registrated just looks like =if(A1="";"";A1). So, there's no real visible data in some records (only the formula as mentioned) regards and thanks, Johan |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Paste into a standard module - and make changes (***) to suit.
Sub PrintOnlyColumnsWithValues() Dim cell As Range Application.ScreenUpdating = False With ActiveSheet For Each cell In .Range("C20:K20") '<<<<*** If cell.Value = 0 Then cell.EntireColumn.Hidden = True Next .PrintOut ' Or PrintPreview .Range("C20:K20").Columns.Hidden = False '<<<<*** End With Application.ScreenUpdating = True End Sub Also, in your Thisworkbook module, paste in: Private Sub Workbook_BeforePrint(Cancel As Boolean) Application.EnableEvents = False PrintOnlyColumnsWithValues Cancel = True Application.EnableEvents = True End Sub HTH Jim May "johan" wrote: Hello, Somebody can help me ? I need a macro that hide all the columns from column C till the last used column where no data is registrated in recordnr 2. Remarks..... in record nr.2, in all the columns, a formula is registrated just looks like =if(A1="";"";A1). So, there's no real visible data in some records (only the formula as mentioned) regards and thanks, Johan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
HIDE COLUMNS | Excel Discussion (Misc queries) | |||
Hide/Unhide columns using button on top over relevant columns | Excel Discussion (Misc queries) | |||
Hide some columns? | New Users to Excel | |||
Hide Cell Content if no data in previous columns | Excel Discussion (Misc queries) | |||
Cannot Hide Columns | Excel Discussion (Misc queries) |