Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
using the Excel generic worksheet names instead of user-given names in code | Excel Discussion (Misc queries) | |||
Find Worksheet code names from PowerPoint 2007 | Excel Programming | |||
Code to create worksheet names based on the values in the selectedrange | Excel Programming | |||
how to copy workbook names and worksheet names to columns in acces | Excel Programming | |||
return all worksheet tab names and chart sheet tab names in report - an example | Excel Programming |