Hide a column using a macro based on the value of a cell

Solved
nono22740 -  
 nono22740 -
Hello,

As a beginner in Excel, I would like to know how to create a macro to hide each column between A and BZ if the cell A1, B1, ... BZ1 has a value of 0.
I am using Excel 2010.

Thank you very much in advance!

Configuration: Windows 7 / Chrome 23.0.1271.95

2 answers

Mike-31 Posted messages 18405 Registration date   Status Contributor Last intervention   5 147
 
Hi,

Like this

Sub test()
For Col = 1 To 78
If Cells(1, Col) = "0" Then Columns(Col).Hidden = True
Next
End Sub

--
See you +
Mike-31

A period of failure is a perfect time to sow the seeds of knowledge.
0