+ Reply to Thread
Results 1 to 4 of 4

APPLY Header Codes

Hybrid View

diakonos1984 APPLY Header Codes 09-03-2013, 03:10 PM
shg Re: APPLY Header Codes 09-03-2013, 03:26 PM
diakonos1984 Re: APPLY Header Codes 09-03-2013, 03:37 PM
shg Re: APPLY Header Codes 09-03-2013, 03:48 PM
  1. #1
    Registered User
    Join Date
    11-06-2009
    Location
    Arkansas
    MS-Off Ver
    Excel 2007
    Posts
    48

    Unhappy APPLY Header Codes

    So from this nifty link here
    http://msdn.microsoft.com/en-us/libr...ffice.12).aspx
    I see that I can programmatically define headers and footers with VBA.
    This code works nicely, but with one major glitch!
    ActiveSheet.PageSetup.CenterHeader = "&""Tahoma""&16 " & "&[Tab]"
    I implement the code in the immediate window while watching the sheet in Page Layout, and it just makes the header say
    Tab]
    I then click inside the header, and then on the spreadsheet itself, and the header updates to give the actual sheet name.
    The issue is, I am automating this spreadsheet to AVOID manual clicking! I can't afford to click on 150+ headers for this workbook I'm building automatically.
    What do I need to do to actually make the header automatically run the code and list the sheet name?
    I tried recording a macro of doing it and didn't turn anything up that I wasn't already doing.
    So I have resorted to the final authority! This great forum!
    Thanks for helping.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: APPLY Header Codes

    When I record a macro, I see

    ActiveSheet.PageSetup.CenterHeader = "&""Tahoma,Regular""&16&A"
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    11-06-2009
    Location
    Arkansas
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: APPLY Header Codes

    *facepalm*
    Some things are so simple. The header code you posted (&A) is in the link I posted. I used the link for other things, but copied the Sheet name code right out of the custom header dialog box, assuming it was going to be the same as what was in the article... it's not.
    I didn't spot the &A in my recorded macro a midst all the other PageSetup items...
    Thanks a lot. Works like a charm.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: APPLY Header Codes

    You're welcome. We all get blind spots now and then.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] vba to fill header value to apply to below cells of nonblank
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-25-2013, 12:23 PM
  2. [SOLVED] Design - Table style only coloring in the header and first row - how to get it to apply to
    By KathleenTurnis in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 09-18-2012, 10:37 AM
  3. Replies: 0
    Last Post: 04-28-2006, 01:00 PM
  4. apply header to selected sheets in excel
    By yumpin yenny in forum Excel General
    Replies: 1
    Last Post: 03-16-2006, 02:55 PM
  5. [SOLVED] How to apply both Italic & Bold in Header & Footer?
    By Regina Man in forum Excel General
    Replies: 1
    Last Post: 09-26-2005, 05:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1