Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Turn filters on in multiple sheets

What is the code for turning the auto filter on in all the sheets in a
workbook (headers are on row 2) and have them filter for the same criteria
"JS" in column 2.

Thank you for your help,

Esther
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Turn filters on in multiple sheets

Try this

Sub test()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Range("A2").CurrentRegion.AutoFilter Field:=2, Criteria1:="JS"
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"EstherJ" wrote in message ...
What is the code for turning the auto filter on in all the sheets in a
workbook (headers are on row 2) and have them filter for the same criteria
"JS" in column 2.

Thank you for your help,

Esther



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Turn filters on in multiple sheets

It works but needs some tweaking. It brings up an error message saying
"Autofilter method of Range class failed" and the headers (Row 2) and the
drop down arrows are hidden. Any ideas.

Thanks,

Esther

"Ron de Bruin" wrote:

Try this

Sub test()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Range("A2").CurrentRegion.AutoFilter Field:=2, Criteria1:="JS"
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"EstherJ" wrote in message ...
What is the code for turning the auto filter on in all the sheets in a
workbook (headers are on row 2) and have them filter for the same criteria
"JS" in column 2.

Thank you for your help,

Esther




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Turn filters on in multiple sheets

hi Esther

Is row 1 empty ?
If you want you can send me your test workbook private then I look at it

--
Regards Ron de Bruin
http://www.rondebruin.nl


"EstherJ" wrote in message ...
It works but needs some tweaking. It brings up an error message saying
"Autofilter method of Range class failed" and the headers (Row 2) and the
drop down arrows are hidden. Any ideas.

Thanks,

Esther

"Ron de Bruin" wrote:

Try this

Sub test()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Range("A2").CurrentRegion.AutoFilter Field:=2, Criteria1:="JS"
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"EstherJ" wrote in message ...
What is the code for turning the auto filter on in all the sheets in a
workbook (headers are on row 2) and have them filter for the same criteria
"JS" in column 2.

Thank you for your help,

Esther






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Turn filters on in multiple sheets

I think I have solved the problems. The error message I think was due to a
blank sheet. The hidden column headers (row 2) was to do with row 1. As it
was not blank the range included row 1 so I have added the offset code and
all seems OK.

Sub Test()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Range("A2").CurrentRegion.Offset(rowoffset:=1,
columnoffset:=0).AutoFilter Field:=2, Criteria1:="JS"
Next
End Sub

Thank you for you help.
Esther

"Ron de Bruin" wrote:

hi Esther

Is row 1 empty ?
If you want you can send me your test workbook private then I look at it

--
Regards Ron de Bruin
http://www.rondebruin.nl


"EstherJ" wrote in message ...
It works but needs some tweaking. It brings up an error message saying
"Autofilter method of Range class failed" and the headers (Row 2) and the
drop down arrows are hidden. Any ideas.

Thanks,

Esther

"Ron de Bruin" wrote:

Try this

Sub test()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Range("A2").CurrentRegion.AutoFilter Field:=2, Criteria1:="JS"
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"EstherJ" wrote in message ...
What is the code for turning the auto filter on in all the sheets in a
workbook (headers are on row 2) and have them filter for the same criteria
"JS" in column 2.

Thank you for your help,

Esther








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Turn filters on in multiple sheets

Thank you for you help
You are welcome

--
Regards Ron de Bruin
http://www.rondebruin.nl


"EstherJ" wrote in message ...
I think I have solved the problems. The error message I think was due to a
blank sheet. The hidden column headers (row 2) was to do with row 1. As it
was not blank the range included row 1 so I have added the offset code and
all seems OK.

Sub Test()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Range("A2").CurrentRegion.Offset(rowoffset:=1,
columnoffset:=0).AutoFilter Field:=2, Criteria1:="JS"
Next
End Sub

Thank you for you help.
Esther

"Ron de Bruin" wrote:

hi Esther

Is row 1 empty ?
If you want you can send me your test workbook private then I look at it

--
Regards Ron de Bruin
http://www.rondebruin.nl


"EstherJ" wrote in message ...
It works but needs some tweaking. It brings up an error message saying
"Autofilter method of Range class failed" and the headers (Row 2) and the
drop down arrows are hidden. Any ideas.

Thanks,

Esther

"Ron de Bruin" wrote:

Try this

Sub test()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Range("A2").CurrentRegion.AutoFilter Field:=2, Criteria1:="JS"
Next
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"EstherJ" wrote in message ...
What is the code for turning the auto filter on in all the sheets in a
workbook (headers are on row 2) and have them filter for the same criteria
"JS" in column 2.

Thank you for your help,

Esther








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Turn filters on in multiple sheets

hellow sir,

i need your guidence, i have a unique list in column AI. I Want to
apply auto filter in column D. for each unique items. i want to check the
no of visible rows after filtered. if it is smaller than 30 . i have to
update column J with the current year for all the sks in
the visible rows. if it is greater than 30 . i have to upadted J column
with the current year. 1/3 times of the visible rows.(ex if the visible rows
of unique items is 100, i have to updated 34 rows.) and after doing this, i
have to copy the visible rows for each unique items and save in a new folder
and save the file.

all the unique items must be saved in a new folder and
new file ok.

i will be very happy if you help me.
with regards,
harish.
mail id:

url:
http://www.ureader.com/msg/103711524.aspx
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
how to link filters in two different sheets? sunny123 Excel Discussion (Misc queries) 0 May 27th 09 07:55 PM
how to link filters in two different sheets? sunny123 Excel Discussion (Misc queries) 0 May 27th 09 05:19 PM
Filters using multiple sheets Scott A Excel Worksheet Functions 0 January 23rd 08 03:07 AM
How do I add multiple filters sam Excel Discussion (Misc queries) 1 June 25th 07 12:56 PM
Turn ON Autofilter Filters dcHill Excel Programming 1 June 16th 05 07:53 PM


All times are GMT +1. The time now is 10:05 AM.

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"