how to do for each worksheet in workbook exept one sheet??

  • Thread starter Thread starter matthias
  • Start date Start date
M

matthias

this is part of my source code

For Each sh In ActiveWorkbook.Worksheets
sh.Range("b7").AutoFilter field:=1, Criteria1:="<>",
visibledropdown:=False
Next

I want to use this but worksheet("overview") may not participate in
the" for each" procedure
something with exit for?

thankx
 
Matthias,

This is something like what I use at the moment


Dim wks As Worksheet
Set ActSheet = ActiveSheet
overview.activate
For Each wks In ActSheet.Parent.Worksheets
If wks.Name <> ActSheet.Name Then
'do nothing
Else
For Each sh In ActiveWorkbook.Worksheets
sh.Range("b7").AutoFilter field:=1, Criteria1:="<>",
visibledropdown:=False
Next


HTH

Duncan
 
ooops,

miss out your for each, i just copied your code and pasted it in.

I think there is a better way though.........................
 
For Each sh In ActiveWorkbook.Worksheets
If sh.Name <> "overview" Then
sh.Range("b7").AutoFilter field:=1, _
Criteria1:="<>", _
visibledropdown:=False
End If
Next

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top