#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Very simple



This has got to be one of the easiest questions ever asked. I'm trying
to add a loop ( a For each loop) to a macro that will perform the macro
on all but one worksheet in the current workbook. The only worksheet
that I do not what it to run on will always have the same name, but the
sheets that I want the macro to run on will not always be the same.

Can anyone help?

Thanks.

Aaron

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Very simple

Aaron,

Try some code like the following:

Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
If StrComp(WS.Name, "do_not_process") < 0 Then
' do something with WS
End If
Next WS

This will do something with every worksheet except the one named
"do_not_process".


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"Aaron Cooper" wrote in message
...


This has got to be one of the easiest questions ever asked.

I'm trying
to add a loop ( a For each loop) to a macro that will perform

the macro
on all but one worksheet in the current workbook. The only

worksheet
that I do not what it to run on will always have the same name,

but the
sheets that I want the macro to run on will not always be the

same.

Can anyone help?

Thanks.

Aaron

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Very simple

For i = 1 to sheets.count
if worksheets(i).name < "YourSheetNameToExclude" then
'run your macro...which must refer to worksheets(i)
end if
next

On 4/16/04 10:57, in article , "Aaron
Cooper" wrote:



This has got to be one of the easiest questions ever asked. I'm trying
to add a loop ( a For each loop) to a macro that will perform the macro
on all but one worksheet in the current workbook. The only worksheet
that I do not what it to run on will always have the same name, but the
sheets that I want the macro to run on will not always be the same.

Can anyone help?

Thanks.

Aaron

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


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
IF formula-simple question; simple operator Rich D Excel Discussion (Misc queries) 4 December 6th 07 03:36 PM
Simple problem, simple formula, no FUNCTION ! Ron@Buy Excel Worksheet Functions 6 September 28th 07 04:51 PM
Simple Simple Excel usage question BookerW Excel Discussion (Misc queries) 1 June 23rd 05 10:06 PM
Make it more simple or intuitive to do simple things Vernie Charts and Charting in Excel 1 March 16th 05 04:01 AM
simple question, hopefully a simple answer! Matt B Excel Programming 5 January 13th 04 08:43 PM


All times are GMT +1. The time now is 06:04 PM.

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"