Mac excel entire column for criteria range

broken image
broken image

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

broken image

Just make sure that you put this version in the code window for the worksheet on which you want it to work. If you want the hiding and unhiding of the column to be done in real time, you can use the following version of the macro. If cell B4 does not contain 0, then column H is displayed. The following simple macro, for instance, examines the contents of cell B4 and, if the cell contains 0, hides column H. You can, however, achieve the desired effect by using a macro to analyze the cell and adjust the Hidden attribute of the row you want to conditionally hide. There is no way, unfortunately, to easily hide entire columns of data based on the value of a particular cell. Excel's great conditional formatting capabilities allow you to change the formatting of cells based on the content of a cell.