> tech

Saturday, 17 June 2006

holy macro

If you ever needed a macro to edit the page header of an excel spreadsheet using the currently selected criteria of an autofilter filter within the spreadsheet... then you are pretty lame.
But anyway, here it is:

Sub UpdateHeader()
ActiveSheet.PageSetup.CenterHeader = "&B&11" &
Mid(Range("J1").Parent.AutoFilter.Filters(1).Criteria1, 2)
ActiveSheet.PrintPreview
End Sub


"J1" is the cell where your autofilter filter is found. This also sets the header text to bold and size 11, and then opens a Print Preview.

Trackbacks

    No Trackbacks

Comments

Display comments as (Linear | Threaded)

    No comments


Add Comment


Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA 1CAPTCHA 2CAPTCHA 3CAPTCHA 4CAPTCHA 5