P
P
partyzanx2019-04-03 14:22:22
excel
partyzanx, 2019-04-03 14:22:22

How to hide column in excel

How to make columns disappear (and not printed on the printer) if the specified cell of this column on line 9 is equal to ""
Cells from the range =AF9:AH9
5ca496b58c243741422363.png
For example, now empty cells AG9 (column AG is hidden), AH9 (column AH is hidden ).
We work only with the range AF9:AH9, I repeat, we are interested in the disappearance of the columns AF, AG, AH, if the cells AF9, AG9, AH9 are empty, respectively.
If there was an empty cell AF9 , then the entire AF column would be hidden.
This is about the horizontal filter)
File https://yadi.sk/i/LAyfqVFjWe0kFA

PS In the "TEX" sheet, the month February is now 29 days, respectively, the column with the 30th and 31st numbers should disappear.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
shushpanio, 2019-04-03
@partyzanx

There is a crutch option using conditional formatting.
Create rules (I write the rule formula for cell D11, then stretch the formatting of the cells throughout the table)
=if(D9="";1;0)
In the rule format, set the white font for the cell
Second rule =if(D9="";0;1 )
In the format, set the boundaries of the cells
On the screen, an example of the result
5ca4b4dcbe092687738652.jpeg

L
lvv85, 2019-04-03
@lvv85

You can write an event handlerWorksheet_Change

Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Me.Range("AF9:AH9")) Is Nothing Then
        If Target.Value2 = "" Then
            Target.EntireColumn.Hidden = True
        End If
    End If
End Sub

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question