View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Auto Hide-Unhide Columns with a macro

Give this a whirl...

Sub HideUnhideColumns()
Dim rngToHide As Range

On Error Resume Next
Set rngToHide = ActiveCell.EntireRow.SpecialCells(xlCellTypeBlanks )
On Error GoTo 0

If Not rngToHide Is Nothing Then
ActiveSheet.Cells.EntireColumn.Hidden = False
rngToHide.EntireColumn.Hidden = True
End If
End Sub

--
HTH...

Jim Thomlinson


"Ed" wrote:

Hello,
I have a table from A1:EG70 that looks like a checkerboard, not all cells
have info in them. Does anyone know a macro to auto hide the empty columns
within the active row? The idea is to have visible only the columns with info
while browsing vertically the different entries.

thanks!