Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unhide 1 column at a time from named range blonde1030 Excel Programming 9 June 16th 07 01:09 AM
Worksheet_Change event to unhide columns based on value in range Steve E Excel Programming 7 September 29th 06 11:19 PM
Unhide Columns in certain range Desert Piranha[_86_] Excel Programming 6 July 14th 06 06:37 AM
Checkbox to hide/unhide named range Joel Mills Excel Programming 3 May 25th 05 04:38 PM
Named Range - Empty columns Tempy Excel Programming 8 July 8th 04 03:56 PM


All times are GMT +1. The time now is 03:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"