Question:
Excel Column Hiding Problem?
per4more
2007-02-05 03:38:03 UTC
I'm trying to find a way in excel, either by condition, formula or VBA, ( VBA last option ) to hide a column if a cell does not contain any value, if a user enters a value into the cell, the column unhides.

Please if you knw the answer give me a non-VBA answer if you know, otherwise I'll settle for the VBA answer if there is none.
Three answers:
2007-02-05 09:35:59 UTC
I do not know a non VBA way to do this.

Here is one way

I used cell D14 and hide column G



Right click on your sheet tab and choose veiw code from the menu, then past this





Private Sub Worksheet_Change(ByVal Target As Range)



If [d14] = 0 Or [d14] = "" Then

Columns("G:G").EntireColumn. Hidden = True

Else: Columns("G:G").EntireColumn. Hidden = False

End If

End Sub
2016-11-25 08:19:44 UTC
Your recommendations of utilising both a 2d sheet with the names and X's to both comprise or exclude them, or utilising checkboxes, will artwork. more convenient to do because that is swifter is the 2d sheet with corporation names and X's. extra stylish and extra perfect looking is the checkboxes, yet which will be tedious to make certain for one hundred+ names. that is, although, extremely person-friendly to do. The checkbox will be proper to a unique cellular which will change to authentic (if field is checked) or pretend (unchecked) and also you may base your exclusion or inclusion of a corporation in retaining with that authentic/pretend. enable's say you set up a checkbox and the proper cellular is C101, to attempt for authentic/pretend, only use this: =IF(C101, your_formula, "") If C101 = authentic, that is popular with the field is checked, and could execute the formulation. If that is fake, then it blanks out the cellular, and also you may sum or trouble-free in common words the cells with numbers showing.
deval_agrifarman
2007-02-05 04:24:55 UTC
u should done it in vba


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...