Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,814
Default Cycle through non-hidden pages only

I have a workbook with several hidden pages. I'm trying to write some vb code
that will cycle though the Visible pages and ignore those that are hidden.
Any help would be greatly appreciated.
Thanks Steve
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default Cycle through non-hidden pages only

The following code will not run, but hopefully it will point you in the
proper direction. Using the IF statement to determine whether or not
something happens to a particular worksheet in the current workbook:

Sub VisibleOnly()

Dim wb As Workbook
Dim ws As Worksheet

Set wb = ThisWorkbook

For Each ws In wb.Worksheets
If ws.Visible Then
Do something here
End If
Next ws

Set ws = Nothing
Set wb = Nothing

End Sub

--
Kevin Backmann


"Steve" wrote:

I have a workbook with several hidden pages. I'm trying to write some vb code
that will cycle though the Visible pages and ignore those that are hidden.
Any help would be greatly appreciated.
Thanks Steve

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Cycle through non-hidden pages only

Sub doifnothiddensheet()
For Each ws In Worksheets
If ws.Visible = True Then 'do this
Next ws
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Steve" wrote in message
...
I have a workbook with several hidden pages. I'm trying to write some vb
code
that will cycle though the Visible pages and ignore those that are hidden.
Any help would be greatly appreciated.
Thanks Steve


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 611
Default Cycle through non-hidden pages only

Steve,

Try this:

Sub CycleSheets()
Dim sheett As Worksheet
For Each sheett In Sheets()
If sheett.Visible Then

' your code here

End If
Next sheett
End Sub

--
Regards from Virginia Beach,

Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Steve" wrote in message
...
I have a workbook with several hidden pages. I'm trying to write some vb code
that will cycle though the Visible pages and ignore those that are hidden.
Any help would be greatly appreciated.
Thanks Steve



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,814
Default Cycle through non-hidden pages only

Thanks Kevin
Works great!
Steve

"Kevin B" wrote:

The following code will not run, but hopefully it will point you in the
proper direction. Using the IF statement to determine whether or not
something happens to a particular worksheet in the current workbook:

Sub VisibleOnly()

Dim wb As Workbook
Dim ws As Worksheet

Set wb = ThisWorkbook

For Each ws In wb.Worksheets
If ws.Visible Then
Do something here
End If
Next ws

Set ws = Nothing
Set wb = Nothing

End Sub

--
Kevin Backmann


"Steve" wrote:

I have a workbook with several hidden pages. I'm trying to write some vb code
that will cycle though the Visible pages and ignore those that are hidden.
Any help would be greatly appreciated.
Thanks Steve



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,814
Default Cycle through non-hidden pages only

works just fine
Thanks
Steve

"Don Guillett" wrote:

Sub doifnothiddensheet()
For Each ws In Worksheets
If ws.Visible = True Then 'do this
Next ws
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Steve" wrote in message
...
I have a workbook with several hidden pages. I'm trying to write some vb
code
that will cycle though the Visible pages and ignore those that are hidden.
Any help would be greatly appreciated.
Thanks Steve



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,814
Default Cycle through non-hidden pages only

Thanks to all. Code works great
Steve

"Earl Kiosterud" wrote:

Steve,

Try this:

Sub CycleSheets()
Dim sheett As Worksheet
For Each sheett In Sheets()
If sheett.Visible Then

' your code here

End If
Next sheett
End Sub

--
Regards from Virginia Beach,

Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Steve" wrote in message
...
I have a workbook with several hidden pages. I'm trying to write some vb code
that will cycle though the Visible pages and ignore those that are hidden.
Any help would be greatly appreciated.
Thanks Steve




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
cycle time mmb Charts and Charting in Excel 1 August 21st 08 03:24 PM
Time Cycle Antonio Excel Discussion (Misc queries) 7 December 3rd 07 11:01 PM
How do I keep result from 1 iteration cycle to use in next cycle? sgl8akm Excel Discussion (Misc queries) 0 July 27th 06 08:28 PM
Pages hidden with manual breaks still print D Poole Excel Discussion (Misc queries) 1 February 10th 06 02:43 PM
How do I cycle through all of the worksheets DMB Excel Discussion (Misc queries) 1 January 9th 06 12:21 AM


All times are GMT +1. The time now is 01:37 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"