Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
unhide columns in named range
Hello,
I received this code to unhide columns one at a time in a named range from Dave Peterson, and it works exactly as hoped! But now spreadsheet users want to add their own worksheets. How can I make this active sheet specific, rather than named sheet specific? Appreciate any help! 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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
unhide columns in named range
got it: With ActiveWorkbook.ActiveSheet
thx "blonde1030" wrote: Hello, I received this code to unhide columns one at a time in a named range from Dave Peterson, and it works exactly as hoped! But now spreadsheet users want to add their own worksheets. How can I make this active sheet specific, rather than named sheet specific? Appreciate any help! 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unhide 1 column at a time from named range | Excel Programming | |||
Worksheet_Change event to unhide columns based on value in range | Excel Programming | |||
Unhide Columns in certain range | Excel Programming | |||
Checkbox to hide/unhide named range | Excel Programming | |||
Named Range - Empty columns | Excel Programming |