Try this Sub MakeCenterHeaderSAS() mc = 1 For Each objFilterPart In ActiveSheet.AutoFilter.Filters If objFilterPart.On Then ms = ms & " " & ActiveSheet.AutoFilter.Range.Columns(lngcount).Column End If mc = mc + 1 Next
With ActiveSheet.Range("$A$2:$A" & Range("A" & Rows.Count).End(xlUp).Row) If Left(ms, 2) = 4 Then mf = " from " & .Offset(1, 4).SpecialCells(xlCellTypeVisible) Else mf = "" End If myheader = .Offset(1, 6).SpecialCells(xlCellTypeVisible) & " Members" & mf 'MsgBox myheader ActiveSheet.PageSetup.CenterHeader = myheader End With End Sub From: Steve May Sent: Tuesday, September 13, 2011 1:19 PM To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ Filtered Info must come into the Header or Footer Dear Noorain, Thank you very much for your quick respose. I am attaching a modified file from excel-macros@googlegroups.com, with my request. Thank you once again. On Tue, Sep 13, 2011 at 10:55 PM, NOORAIN ANSARI <noorain.ans...@gmail.com> wrote: Dear Steve, Can you u provide excel sheet with Example.. On Tue, Sep 13, 2011 at 10:21 PM, Steve May <stevema...@gmail.com> wrote: Dear Friend, I have table with many columns. If one of them is gender and it contains either 'Boy' or 'Girl'. 1. If I filter only 'Boy' then the Header or Footer must have "Boy" in it. 2. Further before printing excel must ask what should be there in the header or footer. 3. Automatically it must add a word or words related to the filtered word. eg. If I filter 'Boy' then can it have a "Boys Only" Thanking you in Advance. Bye for now Steve -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- Thanks & regards, Noorain Ansari http://excelmacroworld.blogspot.com/ http://noorain-ansari.blogspot.com/ -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel