+ Reply to Thread
Results 1 to 4 of 4

VBa Dynamic Monthly Column Headings

  1. #1
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    VBa Dynamic Monthly Column Headings

    Hi, I wonder whether someone may be able to help me please.

    I'm currently using a sheet called "Monthly Profile" which has the following column headers from column B to Q.

    Description Resource Nov 13 Dec 13 Jan 14 Feb 14 Mar 14 Apr 14 May 14 Jun 14 Jul 14 Aug 14 Sep 14 Oct 14 Nov 14 Dec 14

    In additon, I display the current month in cell B3 on the same sheet in the format of "mmm yy".

    The monthly column headings must be in the range of two months prior to the current month, and then a further 12 months from the current month.

    In it's current form, every month I have to manually change the column headings to follow the aforementioned range.

    I know from the research I've done that I could use as number of formulas to automate this task, but I was wonderiong whether someone may be able to offer some guidance on whether this could be done automatically within VB, which I can incoporate into a larger script which I use to populate the sheet.

    Many thanks and kind regards

  2. #2
    Forum Contributor
    Join Date
    01-30-2013
    Location
    Wales
    MS-Off Ver
    Excel 2013
    Posts
    231

    Re: VBa Dynamic Monthly Column Headings

    You could do it with formulas.

    B4 = Date(year(b3),month(b3)-2,1) format as mmm yy
    c4 = date(year(b4),month(b4)+1,1) copy this across other columns.

    Or you set your macro to set the formulas in the cells
    Click * below if this answer helped

  3. #3
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBa Dynamic Monthly Column Headings

    Hi @Chris53 thank you for taking the time to reply to my post and for the suggestion.

    I was aware of the formula which can entered manually or automatically, but I just wondered whether there may be better alternative.

    Kind Regards

  4. #4
    Registered User
    Join Date
    12-07-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: VBa Dynamic Monthly Column Headings

    Hi

    Replace your select case with

    Please Login or Register  to view this content.
    See attached, I've also added some code to set up a new year in the on change event of "Desired Output" sheet and clear the output.

    Regards
    Ian
    Attached Files Attached Files

+ 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. Dynamic column headings
    By ianh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2013, 10:53 AM
  2. How to pull column headings into another column for sorting sizes
    By saveme in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-20-2012, 08:32 PM
  3. Replies: 5
    Last Post: 10-26-2011, 11:57 AM
  4. Dynamic Monthly Bar Chart
    By arasan25 in forum Excel General
    Replies: 2
    Last Post: 08-27-2011, 07:42 AM
  5. [SOLVED] Can I invert a table so row headings are now column headings etc
    By Sharon in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-10-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