LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Hide/show sheets by first part of sheet name

Just a variant:

Sub test()
Dim sh As Worksheet
On Error Resume Next
For Each sh in ThisWorkbook.Worksheets
With sh
.Visible = Left(LCase(.Name), 2) = "ne"
End With
Next sh
On Error GoTo 0
End Sub

The "On Error Resume Next" is just in case there are no sheets starting
with "ne" - which would cause the last worksheet to throw a run-time
error since a workbook has to have at least one visible sheet.


In article ,
"Ron de Bruin" wrote:

Hi Brentus

Try something like this
This will only show the sheets with a name that starts with "ne" or "NE"

Sub test()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
If Left(LCase(sh.Name), 2) = "ne" Then
sh.Visible = xlSheetVisible
Else
sh.Visible = xlSheetHidden
End If
Next
End Sub

 
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
dropdown to show only part of data sheet Durai Excel Discussion (Misc queries) 2 November 30th 09 10:50 PM
Name of the sheet - hide and show Lars, Denmark Excel Discussion (Misc queries) 5 January 21st 09 10:08 PM
show only the required part of the sheet Iyer New Users to Excel 3 July 25th 06 04:35 PM
Showing + and - (show and hide) for rows in the sheet Kurt Excel Worksheet Functions 1 November 10th 05 12:53 PM
Show Form, Hide all Sheets John Pierce Excel Programming 2 June 10th 04 10:42 AM


All times are GMT +1. The time now is 09:24 AM.

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

About Us

"It's about Microsoft Excel"