+ Reply to Thread
Results 1 to 4 of 4

Creating a dynamic table

  1. #1
    Registered User
    Join Date
    07-18-2011
    Location
    Washington, DC
    MS-Off Ver
    Excel 2007
    Posts
    24

    Creating a dynamic table

    I am trying to create a macro/develop code that will read two dates (in the format of Month and year) and create a table that has a column for each month.

    For example, Start Date: Nov 2011, End Date: Feb 2012 will create 4 columns with the date in each of the column heading.
    Last edited by kmoore; 07-18-2011 at 08:20 PM.

  2. #2
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Creating a dynamic table

    Welcome to the forum.

    To get you started, here's an example where the start/end dates are provided in the VBA code. Reading the start/nd dates from a worksheet (or a userform or wherever else) is not an issue. This code puts the date series across row 2, starting in column B. You can format the cells accordingly should you wish to hide the day part of the dates.

    Please Login or Register  to view this content.
    Hope that helps,

    Colin

    RAD Excel Blog

  3. #3
    Registered User
    Join Date
    07-18-2011
    Location
    Washington, DC
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Creating a dynamic table

    Thanks Colin, that helps a lot, but how do I do it so it gets the input from the spreadsheet. I would like the number of columns to vary based on user input. One time it may be 4 columns and another time 20. I really appreciate the help.

  4. #4
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Creating a dynamic table

    Hi,

    Let's suppose your spreadsheet has the start date in cell A1, the end date in cell A2 and you want to fill the series from C3 across the row.

    Please Login or Register  to view this content.
    I can't be more specific than that, given the current information on the thread. Adjust the ranges as necessary to suit your needs.
    Last edited by Colin Legg; 07-18-2011 at 04:07 PM. Reason: added colours to help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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