Print filter criteria in page header

jds217

New Member
Joined
Nov 6, 2005
Messages
12
I have a large spreadsheet of book titles, each of which is included on the book lists of one or more schools.

So the format of my data is roughly:
Col A -- book title
Col B -- author
etc., then
Col G -- school #1 (with an 'x' if the title is on that list)
Col H -- school #2
etc.

Using autofilter, I filter the lists so I get only the titles for school A, B, or A & B, etc.

Then I print out the list of that subset, with just the book title, author, etc. columns (not the many school columns)

What I want to be able to do is have the filter criteria appear in the header on the printed page, so I know WHICH school's list I'm printing.

I realize I could just manually change the header each time I print, but this is something dynamic we're doing on the fly for library patrons, and I need to make it easy and automatic.

Thanks for any help you can provide!

John
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Something like
Code:
Sub FilterHead()
    Dim Filt As String
    Filt = InputBox("Enter filter")
    Columns("A:H").AutoFilter Field:=2, Criteria1:=Filt
    ActiveSheet.PageSetup.LeftHeader = Filt
End Sub
 
Upvote 0
thank you...need a little more clairification

Thank you for that...I'm relatively a novice at entering code...WHERE do I put that code in Excel?

Thanks!

John
 
Upvote 0

Forum statistics

Threads
1,215,396
Messages
6,124,685
Members
449,179
Latest member
kfhw720

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top