+ Reply to Thread
Results 1 to 3 of 3

Three line center header macro using input box

  1. #1
    Registered User
    Join Date
    09-01-2015
    Location
    U.S.
    MS-Off Ver
    2010
    Posts
    3

    Three line center header macro using input box

    Can an input prompt just be given for the first line of a three line center header? How would you put in the rest of the script so that one is not having to "input" it each time too?

    Domski replied to a previous post from a similarly posed question in 2012 wherein the following code was given in his answer:
    Please Login or Register  to view this content.
    What if you only want an input prompt for the subject of a three line center header such as in:

    (Prompt for subject)
    For Month Ended
    November 30, 2016

    My macro header is used for many workbooks, so the only thing that is consistent is the "For Month Ended" and the date scripts. Although I do have to go in to the code and change the date when a new month has arrived, I know of no other way to do this since I wouldn't want to have to type it in at each input prompt either.


    Thanks!

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Three line center header macro using input box

    For header with 3 lines. I'd do something like below.
    Please Login or Register  to view this content.
    DateSerial part is used to return last date for previous month (from current date).

  3. #3
    Registered User
    Join Date
    09-01-2015
    Location
    U.S.
    MS-Off Ver
    2010
    Posts
    3

    Re: Three line center header macro using input box

    Thank you so much. Sorry this is a late response...I get pulled away with other work for days on end.

    This fix works very well, and was so simple to see. These things elude me as a novice VBAer. I very much appreciate the DateSerial part. However, in order to make it a string result instead of a numeric output (December 31, 2016 rather than 12/31/2016, for example), I used both a DateValue and a Format function. I had to do some digging to figure this out and still may not have it technically correct, but it worked for me.

    I used the DateValue in front of the DateSerial part and then also found that I had to use a Format code in front of the DateValue part to get it the way I needed it.

    Like so:

    HTML Code: 
    It's possible I have more than I need with that coding, but it did work.

    Thank you kindly for your help.

+ 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] Excel 2007 VBA - Multiple line header adds empty line in between
    By ChrisPatterson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-22-2014, 08:54 AM
  2. how to Use Before_Print macro to add a multiple line header
    By today2014 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-28-2014, 04:04 PM
  3. Macro that would draw a line using cell borders after user input
    By Tom T Hall in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-21-2014, 11:25 AM
  4. Data Input Form with number of line items based on user input
    By j_gideon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2013, 02:54 PM
  5. Blank Line when using Center Across Selection
    By jcoulter in forum Excel General
    Replies: 2
    Last Post: 01-10-2012, 12:26 PM
  6. Formatting center header
    By RPOD in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-04-2009, 01:17 PM
  7. [SOLVED] Named Range in Center Header
    By Joel Mills in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-05-2005, 04:06 PM

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