

We do not need to give the full column reference to hide the column. For instance, if we have data in cell A2 and want to use that in cell A1, use =A2 in cell A1, and this will copy the A2 value in A1. We can also hide a column based on a single cell reference Cell Reference Cell reference in excel is referring the other cells to a cell to use its values or properties. Example #4 – Hide Columns with Single Cell The above methods will hide the first three columns: A, B, and C. We can also use the following code to hide multiple columns in Excel VBA.Ĭolumns("A:C").EntireColumn.Hidden = True End Sub Range("A:C").EntireColumn.Hidden = True End Sub Using the following code to hide multiple columns for the same data as example #1. We need to mention the first and the last column so that in between columns also will be hidden. We can hide multiple columns at a time as well. read more based on the method we use.Ĭolumns(4).EntireColumn.Hidden = True End Sub We need to construct our VBA code VBA Code VBA code refers to a set of instructions written by the user in the Visual Basic Applications programming language on a Visual Basic Editor (VBE) to perform a specific task. In VBA concepts, cells are also the same, no different from normal excel cells. We can hide a column using a Range object using the CELLS property Using CELLS Property Cells are cells of the worksheet, and in VBA, when we refer to cells as a range property, we refer to the same cells. Then, we need to set the Hidden property to TRUE.

We need to use the “Hidden” property in the column property. Then, we need to use the Property “Entire Column.” Range("A:A").EntireColumn Example #7 – Hide Columns Based On Cell Value.Example #5 – Hide Every Alternative Column.Example #4 – Hide Columns with Single Cell.Example #2 – Hide using Columns Property.
