Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default Filter Problem

I have this code where I am trying to filter each sheet in the workbook
on column "I" for 2006, except the first sheet. I am not quite there.
Need help. TIA

Sub Filter2006()
Dim sh As Worksheet

With ActiveWorkbook
For Each sh In Worksheets

If sh.Name = "IS Time Q1_06" Then

Else

Range("A1:L1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=9, Criteria1:="2006"

End If

Next sh

End With

End Sub

Greg

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Filter Problem

try:

Sub Filter2006()

Dim sh As Worksheet

With ActiveWorkbook
For Each sh In Worksheets

If sh.Name < "IS Time Q1_06" Then

Range("A1:L1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=9, Criteria1:="2006"

End If

Next sh

End With

End Sub
-----------------------------------------------------


"GregR" skrev:

I have this code where I am trying to filter each sheet in the workbook
on column "I" for 2006, except the first sheet. I am not quite there.
Need help. TIA

Sub Filter2006()
Dim sh As Worksheet

With ActiveWorkbook
For Each sh In Worksheets

If sh.Name = "IS Time Q1_06" Then

Else

Range("A1:L1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=9, Criteria1:="2006"

End If

Next sh

End With

End Sub

Greg


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default Filter Problem

Excellent, I thought the statement means

If sh.Name = "IS Time Q1_06" Then

"do nothing"

Else
Code "do something"

Is my thinking mistaken

Greg

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Filter Problem

well i think its the other way round :-)

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default Filter Problem

Excellent, there is also somethig about the filter, some how each sheet
needs to be activated in the loop for the filter to be applied?????



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Filter Problem

y ur right i just notest :-)

For Each sh In Worksheets
sh.Activate ' add this line here ****
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
Filter problem law Excel Discussion (Misc queries) 2 December 1st 07 03:43 PM
problem with filter Pascale Excel Discussion (Misc queries) 5 June 5th 07 04:28 PM
filter problem strictly_rhythm Excel Discussion (Misc queries) 6 July 4th 06 12:24 PM
filter problem strictly_rhythm Excel Discussion (Misc queries) 1 July 3rd 06 09:49 PM
Filter Problem Coal Miner Excel Programming 2 April 27th 06 03:47 PM


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