View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Unhide 1 column at a time from named range

One way:

Option Explicit
Sub testme()
Dim iCol As Long
Dim myRng As Range
Dim UnhidACol As Boolean

With Worksheets("sheet1")
Set myRng = .Range("myrangenamehere")
End With

With myRng.Areas(1)
UnhidACol = False
For iCol = 1 To .Columns.Count
If .Columns(iCol).EntireColumn.Hidden = True Then
.Columns(iCol).EntireColumn.Hidden = False
UnhidACol = True
'get out
Exit For
End If
Next iCol
End With

If UnhidACol = False Then
Beep
End If

End Sub


blonde1030 wrote:

Hello,

I have a named range of columns that are hidden. I would like a macro that
will unhide the left-most column (that is hidden) in the range when a button
is clicked.

For instance, clicking the button once would unhide column 1 of range.
Clicking button again would unhide column 2 of hidden range, and so forth.

I greatly appreciate any help!


--

Dave Peterson