+ Reply to Thread
Results 1 to 2 of 2

list of all quarters including and between cells A1 and A2

Hybrid View

  1. #1
    Registered User
    Join Date
    09-15-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    35

    list of all quarters including and between cells A1 and A2

    Hi,

    Im looking for vba code that will create a list in column b that includes all the quarter end dates including and between two cells, A1 and A2.

    Many Thanks.

  2. #2
    Registered User
    Join Date
    09-15-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    35

    Re: list of all quarters including and between cells A1 and A2

    To answer my own question, Would welcome ideas on way to make this faster/cleaner

    Sub GenerateDates()
    
    Dim FirstDate As Date
    Dim LastDate As Date
    Dim NextDate As Date
    
    FirstDate = Range("A1").Value
    LastDate = Range("a2").Value
    
    NextDate = FirstDate
    Range("B1").Select
    
    Do Until NextDate >= LastDate
    
        ActiveCell.Value = NextDate
        ActiveCell.Offset(1, 0).Select
    
        If Month(NextDate) = 3 Then
            NextDate = DateAdd("q", 1, NextDate)
        Else
        If Month(NextDate) = 12 Then
            NextDate = DateAdd("q", 1, NextDate)
            Else
            If Month(NextDate) = 6 Then
            NextDate = DateAdd("q", 1, NextDate)
        Else
            If Month(NextDate) = 9 Then
            NextDate = DateAdd("q", 1, NextDate)
            NextDate = DateAdd("d", 1, NextDate)
        End If
        End If
        End If
        End If
    
    Loop
    
    End Sub

+ 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] Convert list including char(10) to a clean list
    By scottiex in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-04-2014, 12:02 AM
  2. Replies: 4
    Last Post: 10-23-2013, 06:16 AM
  3. formatting cells with quarters based on date ranges
    By nheb in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-09-2013, 11:11 AM
  4. Replies: 5
    Last Post: 08-06-2013, 02:13 PM
  5. Replies: 2
    Last Post: 05-01-2013, 12:23 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