View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default VBA column hiding

Sub HideColums()
Dim i As Long

For i = 1 To 15
If Application.CountA(Columns(i)) = 0 Then
Columns(i).Hidden = True
End If
Next i

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"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