View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tim Williams Tim Williams is offline
external usenet poster
 
Posts: 1,588
Default Simple looping question

dim arr,x
arr=Array("A","B","D","X")

for x=lbound(arr) to ubound(arr)

with thisworkbook.sheets(arr(x))
'do stuff
end with

next x


Tim



"James8309" wrote in message
...
Hi everyone,

I have about 20 different worksheets in the same workbook. I also have
a main macro for the workbook. I know how to loop the macro through
all the worksheets. However how do I loop the sheets I want only?

i.e. Loop sheets("A"), sheets("B") and Sheets("Z") only, Not running
particular part of marco for other sheets.


Thanks for your help