Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default Using Worksheet Code Names

Hello,
I would like to hide all sheets in a workbook except a sheet with Code Name
wksAdmin. The following code produces error message: object does not
support this property or method. I know i'm referencing wksAdmin
incorrectly, but not sure why. thanks for any help.

Sub HideAllSheetsExceptAdmin()
Dim wksSheet As Worksheet
For Each wksSheet In ActiveWorkbook.Worksheets
If wksSheet < wksAdmin Then
wksSheet.Visible = False
End If
Next wksSheet
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Using Worksheet Code Names

Sub HideAllSheetsExceptAdmin()
Dim wksSheet As Worksheet
For Each wksSheet In ActiveWorkbook.Worksheets
If wksSheet.Name < "wksAdmin" Then
wksSheet.Visible = xlSheetHidden
End If
Next wksSheet
End Sub

"Jake" wrote:

Hello,
I would like to hide all sheets in a workbook except a sheet with Code Name
wksAdmin. The following code produces error message: object does not
support this property or method. I know i'm referencing wksAdmin
incorrectly, but not sure why. thanks for any help.

Sub HideAllSheetsExceptAdmin()
Dim wksSheet As Worksheet
For Each wksSheet In ActiveWorkbook.Worksheets
If wksSheet < wksAdmin Then
wksSheet.Visible = False
End If
Next wksSheet
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Using Worksheet Code Names

Hi

Try this:

Sub HideAllSheetsExceptAdmin()
Dim wksSheet As Worksheet
Dim wAdm As String
wAdm = wksAdmin.Name
For Each wksSheet In ActiveWorkbook.Worksheets
If wksSheet.Name < wksAdm Then
wksSheet.Visible = False
End If
Next wksSheet
End Sub

Regards,
Per


On 17 Dec., 20:16, Jake wrote:
Hello,
I would like to hide all sheets in a workbook except a sheet with Code Name
wksAdmin. *The following code produces error message: *object does not
support this property or method. *I know i'm referencing wksAdmin
incorrectly, but not sure why. *thanks for any help.

Sub HideAllSheetsExceptAdmin()
Dim wksSheet As Worksheet
For Each wksSheet In ActiveWorkbook.Worksheets
* * If wksSheet < wksAdmin Then
* * * * wksSheet.Visible = False
* * End If
Next wksSheet
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Using Worksheet Code Names

If wksSheet.Name < wksAdmin.Name Then
wksSheet.Visible = False
End If

You need apples and apples.



"Jake" wrote:

Hello,
I would like to hide all sheets in a workbook except a sheet with Code Name
wksAdmin. The following code produces error message: object does not
support this property or method. I know i'm referencing wksAdmin
incorrectly, but not sure why. thanks for any help.

Sub HideAllSheetsExceptAdmin()
Dim wksSheet As Worksheet
For Each wksSheet In ActiveWorkbook.Worksheets
If wksSheet < wksAdmin Then
wksSheet.Visible = False
End If
Next wksSheet
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default Using Worksheet Code Names

thanks!

"Per Jessen" wrote:

Hi

Try this:

Sub HideAllSheetsExceptAdmin()
Dim wksSheet As Worksheet
Dim wAdm As String
wAdm = wksAdmin.Name
For Each wksSheet In ActiveWorkbook.Worksheets
If wksSheet.Name < wksAdm Then
wksSheet.Visible = False
End If
Next wksSheet
End Sub

Regards,
Per


On 17 Dec., 20:16, Jake wrote:
Hello,
I would like to hide all sheets in a workbook except a sheet with Code Name
wksAdmin. The following code produces error message: object does not
support this property or method. I know i'm referencing wksAdmin
incorrectly, but not sure why. thanks for any help.

Sub HideAllSheetsExceptAdmin()
Dim wksSheet As Worksheet
For Each wksSheet In ActiveWorkbook.Worksheets
If wksSheet < wksAdmin Then
wksSheet.Visible = False
End If
Next wksSheet
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
using the Excel generic worksheet names instead of user-given names in code Paul Excel Discussion (Misc queries) 5 June 26th 09 08:44 PM
Find Worksheet code names from PowerPoint 2007 Barb Reinhardt Excel Programming 0 September 18th 08 06:26 PM
Code to create worksheet names based on the values in the selectedrange Mike C[_5_] Excel Programming 2 March 17th 08 12:33 AM
how to copy workbook names and worksheet names to columns in acces gokop Excel Programming 4 August 27th 07 11:26 AM
return all worksheet tab names and chart sheet tab names in report - an example DataFreakFromUtah Excel Programming 2 October 6th 04 08:09 PM


All times are GMT +1. The time now is 11:56 PM.

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"