PC Review


Reply
Thread Tools Rate Thread

Apply same filter to all sheets in a workbook

 
 
manfareed
Guest
Posts: n/a
 
      30th Jul 2008
Hi,

I am after a macro which filters by a particular name eg. Tyson in Column B
for all worksheets in a workbook.

I would be attaching this macro to a "macro" button so when the admin click
the button the sheets are filtered for Tyson. If they click another button
then the filter will apply to another name eg. ALI.

Please help with macro. I would record it but each month the sheet names and
number of sheets will vary.

Thanks,

Manir

 
Reply With Quote
 
 
 
 
joshuafandango@dsl.pipex.com
Guest
Posts: n/a
 
      30th Jul 2008
Hi Manir,

How's this do you?

Sub Filter_All_Sheets()
Dim WS As Object
For Each WS In Worksheets
WS.Range("A1:C10").AutoFilter Field:=2, Criteria1:="Tyson"
Next WS
End Sub

Change the Range, Field (2 = column B) & Criteria to suit

JF

On 30 Jul, 16:23, manfareed <manfar...@discussions.microsoft.com>
wrote:
> Hi,
>
> I am after a macro which filters by a particular name eg. Tyson *in Column B
> for all worksheets in a workbook.
>
> I would be attaching this macro to a "macro" button so when the admin click
> the button the sheets are filtered for Tyson. If they click another button
> then the filter will apply to another name eg. ALI.
>
> Please help with macro. I would record it but each month the sheet names and
> number of sheets will vary.
>
> Thanks,
>
> Manir


 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      30th Jul 2008
Should get you going.

Sub eachsht()
For i = 2 To Worksheets.Count
With Sheets(Sheets(i).Name)
MsgBox .Range("a1")
End With
Next i
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"manfareed" <(E-Mail Removed)> wrote in message
news:77BD1AEA-06A4-4E9E-AD17-(E-Mail Removed)...
> Hi,
>
> I am after a macro which filters by a particular name eg. Tyson in Column
> B
> for all worksheets in a workbook.
>
> I would be attaching this macro to a "macro" button so when the admin
> click
> the button the sheets are filtered for Tyson. If they click another button
> then the filter will apply to another name eg. ALI.
>
> Please help with macro. I would record it but each month the sheet names
> and
> number of sheets will vary.
>
> Thanks,
>
> Manir
>


 
Reply With Quote
 
manfareed
Guest
Posts: n/a
 
      31st Jul 2008
Thanks JF ... just what I was after

"(E-Mail Removed)" wrote:

> Hi Manir,
>
> How's this do you?
>
> Sub Filter_All_Sheets()
> Dim WS As Object
> For Each WS In Worksheets
> WS.Range("A1:C10").AutoFilter Field:=2, Criteria1:="Tyson"
> Next WS
> End Sub
>
> Change the Range, Field (2 = column B) & Criteria to suit
>
> JF
>
> On 30 Jul, 16:23, manfareed <manfar...@discussions.microsoft.com>
> wrote:
> > Hi,
> >
> > I am after a macro which filters by a particular name eg. Tyson in Column B
> > for all worksheets in a workbook.
> >
> > I would be attaching this macro to a "macro" button so when the admin click
> > the button the sheets are filtered for Tyson. If they click another button
> > then the filter will apply to another name eg. ALI.
> >
> > Please help with macro. I would record it but each month the sheet names and
> > number of sheets will vary.
> >
> > Thanks,
> >
> > Manir

>
>

 
Reply With Quote
 
manfareed
Guest
Posts: n/a
 
      31st Jul 2008
Thanks Don ... I think I can use your code as well

"Don Guillett" wrote:

> Should get you going.
>
> Sub eachsht()
> For i = 2 To Worksheets.Count
> With Sheets(Sheets(i).Name)
> MsgBox .Range("a1")
> End With
> Next i
> End Sub
>
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> (E-Mail Removed)
> "manfareed" <(E-Mail Removed)> wrote in message
> news:77BD1AEA-06A4-4E9E-AD17-(E-Mail Removed)...
> > Hi,
> >
> > I am after a macro which filters by a particular name eg. Tyson in Column
> > B
> > for all worksheets in a workbook.
> >
> > I would be attaching this macro to a "macro" button so when the admin
> > click
> > the button the sheets are filtered for Tyson. If they click another button
> > then the filter will apply to another name eg. ALI.
> >
> > Please help with macro. I would record it but each month the sheet names
> > and
> > number of sheets will vary.
> >
> > Thanks,
> >
> > Manir
> >

>
>

 
Reply With Quote
 
manfareed
Guest
Posts: n/a
 
      31st Jul 2008
Hi JF ,

How would I exclude the first worksheet. This is going to be a summary sheet
with macro button which the user will click to filter.

Thanks

"(E-Mail Removed)" wrote:

> Hi Manir,
>
> How's this do you?
>
> Sub Filter_All_Sheets()
> Dim WS As Object
> For Each WS In Worksheets
> WS.Range("A1:C10").AutoFilter Field:=2, Criteria1:="Tyson"
> Next WS
> End Sub
>
> Change the Range, Field (2 = column B) & Criteria to suit
>
> JF
>
> On 30 Jul, 16:23, manfareed <manfar...@discussions.microsoft.com>
> wrote:
> > Hi,
> >
> > I am after a macro which filters by a particular name eg. Tyson in Column B
> > for all worksheets in a workbook.
> >
> > I would be attaching this macro to a "macro" button so when the admin click
> > the button the sheets are filtered for Tyson. If they click another button
> > then the filter will apply to another name eg. ALI.
> >
> > Please help with macro. I would record it but each month the sheet names and
> > number of sheets will vary.
> >
> > Thanks,
> >
> > Manir

>
>

 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      31st Jul 2008
if ws.name <>"Summary" then

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"manfareed" <(E-Mail Removed)> wrote in message
news:7F5B521C-3EB5-4BF1-88F3-(E-Mail Removed)...
> Hi JF ,
>
> How would I exclude the first worksheet. This is going to be a summary
> sheet
> with macro button which the user will click to filter.
>
> Thanks
>
> "(E-Mail Removed)" wrote:
>
>> Hi Manir,
>>
>> How's this do you?
>>
>> Sub Filter_All_Sheets()
>> Dim WS As Object
>> For Each WS In Worksheets
>> WS.Range("A1:C10").AutoFilter Field:=2, Criteria1:="Tyson"
>> Next WS
>> End Sub
>>
>> Change the Range, Field (2 = column B) & Criteria to suit
>>
>> JF
>>
>> On 30 Jul, 16:23, manfareed <manfar...@discussions.microsoft.com>
>> wrote:
>> > Hi,
>> >
>> > I am after a macro which filters by a particular name eg. Tyson in
>> > Column B
>> > for all worksheets in a workbook.
>> >
>> > I would be attaching this macro to a "macro" button so when the admin
>> > click
>> > the button the sheets are filtered for Tyson. If they click another
>> > button
>> > then the filter will apply to another name eg. ALI.
>> >
>> > Please help with macro. I would record it but each month the sheet
>> > names and
>> > number of sheets will vary.
>> >
>> > Thanks,
>> >
>> > Manir

>>
>>


 
Reply With Quote
 
manfareed
Guest
Posts: n/a
 
      31st Jul 2008
hi,

this is my final code but i get an error...run time error 91 ??

Sub Filter_All_Booth()
Dim WS As Object
If WS.Name <> "Summary" Then

For Each WS In Worksheets
WS.Range("A250").AutoFilter Field:=2, Criteria1:="Booth"
Next WS

End If

End Sub

thx


"Don Guillett" wrote:

> if ws.name <>"Summary" then
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> (E-Mail Removed)
> "manfareed" <(E-Mail Removed)> wrote in message
> news:7F5B521C-3EB5-4BF1-88F3-(E-Mail Removed)...
> > Hi JF ,
> >
> > How would I exclude the first worksheet. This is going to be a summary
> > sheet
> > with macro button which the user will click to filter.
> >
> > Thanks
> >
> > "(E-Mail Removed)" wrote:
> >
> >> Hi Manir,
> >>
> >> How's this do you?
> >>
> >> Sub Filter_All_Sheets()
> >> Dim WS As Object
> >> For Each WS In Worksheets
> >> WS.Range("A1:C10").AutoFilter Field:=2, Criteria1:="Tyson"
> >> Next WS
> >> End Sub
> >>
> >> Change the Range, Field (2 = column B) & Criteria to suit
> >>
> >> JF
> >>
> >> On 30 Jul, 16:23, manfareed <manfar...@discussions.microsoft.com>
> >> wrote:
> >> > Hi,
> >> >
> >> > I am after a macro which filters by a particular name eg. Tyson in
> >> > Column B
> >> > for all worksheets in a workbook.
> >> >
> >> > I would be attaching this macro to a "macro" button so when the admin
> >> > click
> >> > the button the sheets are filtered for Tyson. If they click another
> >> > button
> >> > then the filter will apply to another name eg. ALI.
> >> >
> >> > Please help with macro. I would record it but each month the sheet
> >> > names and
> >> > number of sheets will vary.
> >> >
> >> > Thanks,
> >> >
> >> > Manir
> >>
> >>

>
>

 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      31st Jul 2008
Sub Filter_All_Booth()
Dim WS As Object

For Each WS In Worksheets
If WS.Name <> "Summary" Then

WS.Range("A250").AutoFilter Field:=2, Criteria1:="Booth"
end if
Next WS
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"manfareed" <(E-Mail Removed)> wrote in message
news:1A0CFC18-A31E-4D03-8CC2-(E-Mail Removed)...
> hi,
>
> this is my final code but i get an error...run time error 91 ??
>
> Sub Filter_All_Booth()
> Dim WS As Object
> If WS.Name <> "Summary" Then
>
> For Each WS In Worksheets
> WS.Range("A250").AutoFilter Field:=2, Criteria1:="Booth"
> Next WS
>
> End If
>
> End Sub
>
> thx
>
>
> "Don Guillett" wrote:
>
>> if ws.name <>"Summary" then
>>
>> --
>> Don Guillett
>> Microsoft MVP Excel
>> SalesAid Software
>> (E-Mail Removed)
>> "manfareed" <(E-Mail Removed)> wrote in message
>> news:7F5B521C-3EB5-4BF1-88F3-(E-Mail Removed)...
>> > Hi JF ,
>> >
>> > How would I exclude the first worksheet. This is going to be a summary
>> > sheet
>> > with macro button which the user will click to filter.
>> >
>> > Thanks
>> >
>> > "(E-Mail Removed)" wrote:
>> >
>> >> Hi Manir,
>> >>
>> >> How's this do you?
>> >>
>> >> Sub Filter_All_Sheets()
>> >> Dim WS As Object
>> >> For Each WS In Worksheets
>> >> WS.Range("A1:C10").AutoFilter Field:=2, Criteria1:="Tyson"
>> >> Next WS
>> >> End Sub
>> >>
>> >> Change the Range, Field (2 = column B) & Criteria to suit
>> >>
>> >> JF
>> >>
>> >> On 30 Jul, 16:23, manfareed <manfar...@discussions.microsoft.com>
>> >> wrote:
>> >> > Hi,
>> >> >
>> >> > I am after a macro which filters by a particular name eg. Tyson in
>> >> > Column B
>> >> > for all worksheets in a workbook.
>> >> >
>> >> > I would be attaching this macro to a "macro" button so when the
>> >> > admin
>> >> > click
>> >> > the button the sheets are filtered for Tyson. If they click another
>> >> > button
>> >> > then the filter will apply to another name eg. ALI.
>> >> >
>> >> > Please help with macro. I would record it but each month the sheet
>> >> > names and
>> >> > number of sheets will vary.
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Manir
>> >>
>> >>

>>
>>


 
Reply With Quote
 
manfareed
Guest
Posts: n/a
 
      31st Jul 2008
Many Thanks ...its been an education.

"Don Guillett" wrote:

> Sub Filter_All_Booth()
> Dim WS As Object
>
> For Each WS In Worksheets
> If WS.Name <> "Summary" Then
>
> WS.Range("A250").AutoFilter Field:=2, Criteria1:="Booth"
> end if
> Next WS
> End Sub
>
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> (E-Mail Removed)
> "manfareed" <(E-Mail Removed)> wrote in message
> news:1A0CFC18-A31E-4D03-8CC2-(E-Mail Removed)...
> > hi,
> >
> > this is my final code but i get an error...run time error 91 ??
> >
> > Sub Filter_All_Booth()
> > Dim WS As Object
> > If WS.Name <> "Summary" Then
> >
> > For Each WS In Worksheets
> > WS.Range("A250").AutoFilter Field:=2, Criteria1:="Booth"
> > Next WS
> >
> > End If
> >
> > End Sub
> >
> > thx
> >
> >
> > "Don Guillett" wrote:
> >
> >> if ws.name <>"Summary" then
> >>
> >> --
> >> Don Guillett
> >> Microsoft MVP Excel
> >> SalesAid Software
> >> (E-Mail Removed)
> >> "manfareed" <(E-Mail Removed)> wrote in message
> >> news:7F5B521C-3EB5-4BF1-88F3-(E-Mail Removed)...
> >> > Hi JF ,
> >> >
> >> > How would I exclude the first worksheet. This is going to be a summary
> >> > sheet
> >> > with macro button which the user will click to filter.
> >> >
> >> > Thanks
> >> >
> >> > "(E-Mail Removed)" wrote:
> >> >
> >> >> Hi Manir,
> >> >>
> >> >> How's this do you?
> >> >>
> >> >> Sub Filter_All_Sheets()
> >> >> Dim WS As Object
> >> >> For Each WS In Worksheets
> >> >> WS.Range("A1:C10").AutoFilter Field:=2, Criteria1:="Tyson"
> >> >> Next WS
> >> >> End Sub
> >> >>
> >> >> Change the Range, Field (2 = column B) & Criteria to suit
> >> >>
> >> >> JF
> >> >>
> >> >> On 30 Jul, 16:23, manfareed <manfar...@discussions.microsoft.com>
> >> >> wrote:
> >> >> > Hi,
> >> >> >
> >> >> > I am after a macro which filters by a particular name eg. Tyson in
> >> >> > Column B
> >> >> > for all worksheets in a workbook.
> >> >> >
> >> >> > I would be attaching this macro to a "macro" button so when the
> >> >> > admin
> >> >> > click
> >> >> > the button the sheets are filtered for Tyson. If they click another
> >> >> > button
> >> >> > then the filter will apply to another name eg. ALI.
> >> >> >
> >> >> > Please help with macro. I would record it but each month the sheet
> >> >> > names and
> >> >> > number of sheets will vary.
> >> >> >
> >> >> > Thanks,
> >> >> >
> >> >> > Manir
> >> >>
> >> >>
> >>
> >>

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apply Conditional Format to all sheets in same workbook Der Musensohn Microsoft Excel Misc 4 26th Feb 2010 04:24 PM
How do I get this Macro to apply to ALL sheets in workbook? =?Utf-8?B?TmV3c2dhbA==?= Microsoft Excel Programming 2 2nd Aug 2007 09:43 PM
apply Macro to all sheets in workbook - loop transferxxx@gmail.com Microsoft Excel Programming 3 19th Jul 2007 08:13 PM
Macro for filter on protected workbook that works for all sheets, no matter what sheets are named? StargateFanFromWork Microsoft Excel Programming 6 26th Jan 2006 06:31 PM
apply same custom header to all sheets in a workbook jchoy Microsoft Excel Misc 2 20th Aug 2004 01:15 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:49 PM.