For Each col In sh.UsedRange
Should have been:
For Each col In sh.UsedRange.Columns
to avoid unnecessary iteration.
---
Regards,
Norman
"Norman Jones" wrote in message
...
Hi Natijoe,
Or, more simply:
Sub Tester01()
Dim col As Range
Dim sh As Worksheet
Set sh = ActiveSheet '<<===== CHANGE
For Each col In sh.UsedRange
col.EntireColumn.Hidden = Application.CountA(col) = 0
Next col
End Sub
---
Regards,
Norman
"natijoe" wrote in
message ...
hello,
does anybody know of a macro of sorts that will check to see if a
column is populated and if not to automatically hide it?
Essentially I have 15 columns of which only 8 may have data and I would
like to hide the remaining columns at one time....
Thanks a lot!
--
natijoe
------------------------------------------------------------------------
natijoe's Profile:
http://www.excelforum.com/member.php...o&userid=25556
View this thread:
http://www.excelforum.com/showthread...hreadid=390024