Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Step through sheets, but exclude one

Hi All.........

I use code similar to the following to step through all the sheets in a
workbook and perform a certain task thereon. It works fine, except that I
would like for the sheet named XXXYYYZZZ to be left alone and the
operation(s) NOT performed thereon. How might I exclude just that one sheet,
yet perform all the operations on all the other sheets?

Dim sh As Object
Dim i as long
i = 0
For Each sh In Sheets
i = i + 1
Sheets(i).Select
Call MyTaskCode

next

TIA for suggestions

Vaya con Dios,
Chuck, CABGx3


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Step through sheets, but exclude one

Try something like

Sub AAA()
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
If StrComp(WS.Name, "XXXXXX", vbTextCompare) < 0 Then
' WS is not the XXXXX worksheet. Do something with WS.
Else
' WS is XXXXX, do nothing.
End If
Next WS
End Sub

--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"CLR" wrote in message
...
Hi All.........

I use code similar to the following to step through all the sheets in a
workbook and perform a certain task thereon. It works fine, except that I
would like for the sheet named XXXYYYZZZ to be left alone and the
operation(s) NOT performed thereon. How might I exclude just that one
sheet,
yet perform all the operations on all the other sheets?

Dim sh As Object
Dim i as long
i = 0
For Each sh In Sheets
i = i + 1
Sheets(i).Select
Call MyTaskCode

next

TIA for suggestions

Vaya con Dios,
Chuck, CABGx3



  #4   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Step through sheets, but exclude one

Thank you kind Sirs.............

My day is done here now but I shall try both suggestions over the
weekend......

Vaya con Dios,
Chuck, CABGx3



"CLR" wrote:

Hi All.........

I use code similar to the following to step through all the sheets in a
workbook and perform a certain task thereon. It works fine, except that I
would like for the sheet named XXXYYYZZZ to be left alone and the
operation(s) NOT performed thereon. How might I exclude just that one sheet,
yet perform all the operations on all the other sheets?

Dim sh As Object
Dim i as long
i = 0
For Each sh In Sheets
i = i + 1
Sheets(i).Select
Call MyTaskCode

next

TIA for suggestions

Vaya con Dios,
Chuck, CABGx3


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
Creating a Drop Down List with Step by Step Instructions for 2007 remarkable Excel Worksheet Functions 2 March 22nd 09 04:36 AM
Exclude Sheets from Macro Lambtwo Excel Programming 6 August 17th 06 10:22 PM
Edit code - exclude sheets Steph[_6_] Excel Programming 7 March 15th 06 03:35 PM
What is the step-by-step procedure for making a data list? Bobgolfs56 Excel Discussion (Misc queries) 1 April 23rd 05 02:19 PM
an array to step through sheets David Shearer Excel Programming 3 March 1st 04 09:26 AM


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