![]() You should see a new module window open up. Make sure ‘ThisWorkbook’ is selected under the VBA project with the same name as your Excel workbook.If you don’t see the Project Explorer, click on View->Project Explorer Once your VBA window opens, you will see all your project files and folders in the Project Explorer on the left side.From the Developer menu ribbon, select Visual Basic.To enter the above code, all you have to do is copy it and paste it in your developer window. Writing the VBA Codeįor Each cell In ("8").Cells It should essentially analyze each cell from A8 to F8 and adjust the ‘Hidden’ attribute of the column that you want to hide. Say you have columns containing sales figures for Monday through Friday, and you want to run a macro to hide all columns that have the letter X in row 8.įor this, we need a macro that will loop through each cell of row 8 and hide the corresponding column. Let us use the following dataset to demonstrate: It can be a number, a letter, a word, or even a phrase. The value, based on which you want to hide the columns, can be anything you like. In this example, we will show you how to hide all columns that contain a particular value in a given cell. Hiding Columns Based on Cell Value when Macro is Executed Hiding Columns in Real-time Based on a Cell Value.Un-hiding Columns Based on Cell Value when Macro is Executed. ![]() ![]() Hiding Columns Based on Cell Value when Macro is Executed.
0 Comments
Leave a Reply. |