Results 1 to 5 of 5

Generate Dates by Month along columns based on Start Date and End Date

Threaded View

  1. #1
    Registered User
    Join Date
    08-18-2011
    Location
    New York, NY
    MS-Off Ver
    Excel 2003
    Posts
    12

    Generate Dates by Month along columns based on Start Date and End Date

    Hello,

    I found the attached VBA for generating dates but can't get it to work. Below is what I am trying to achieve:

    I would like to enter a start date and end date on the first sheet of the attached. I have created names for start date and end date and in the attached file. On the second sheet I would like the start date to populate in A1 and then the next month to populate in B1, the month after to populate in C1, etc. all the way to the end date (which is defined on the first sheet).

    Could someone help me with the VBA? Sheet is attached and VBA below:

    Sub GenerateDatesH()

    Dim FirstDate As Date
    Dim LastDate As Date
    Dim NextDate As Date
    Dim DateOffset As Range
    Dim DateIter As Date

    FirstDate = Range("startdate").Value
    LastDate = Range("enddate").Value
    Set DateOffset = Range("C1")

    For DateIter = FirstDate To LastDate
    DateOffset.Value = DateIter
    Set DateOffset = DateOffset.Offset(0, 1)
    Next DateIter

    End Sub

    Thank you!
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Help in writing formula in excel to produce dates based on start date and end date
    By shoot for moon in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-10-2014, 01:00 PM
  2. Replies: 1
    Last Post: 09-12-2012, 10:40 AM
  3. Using VBA to fill col with dates based on start and end date
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-22-2011, 11:58 AM
  4. Looping Generating Specific Dates in Six Month Intervals between end and start date
    By LenaJ887 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-16-2010, 02:59 AM
  5. formula to generate month-to-date based on auto date
    By infinitysales in forum Excel General
    Replies: 1
    Last Post: 06-27-2008, 01:09 AM
  6. [SOLVED] Calculate Start Dates based on Need-By Date?
    By GB in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-21-2006, 02:15 PM
  7. [SOLVED] How do I generate a new sheet based on date/week/month?
    By Jay in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-10-2006, 04:55 AM

Tags for this Thread

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