hide columns macro
Hi Xkarenxxxx,
Try,
'=============
Sub Tester()
Dim SH As Worksheet
Dim col As Range
Dim LastCell As Range
Set SH = ThisWorkbook.Sheets("Sheet1") '<<==== CHANGE
For Each col In SH.UsedRange.Columns
Set LastCell = Cells(Rows.Count, col.Column).End(xlUp)
col.Hidden = LastCell.Value = 0
Next col
End Sub
'<<=============
---
Regards,
Norman
"xkarenxxxx" wrote in message
...
I want to write a macro which hides columns if the value in the bottom row
of
the column is 0.
Can anyone help?
|