+ Reply to Thread
Results 1 to 4 of 4

Is there a way to display all dates in a range of dates?

Hybrid View

dwx Is there a way to display all... 09-27-2013, 09:07 AM
greggpetersen75 Re: Is there a way to display... 09-27-2013, 09:56 AM
sktneer Re: Is there a way to display... 09-27-2013, 09:56 AM
Pete_UK Re: Is there a way to display... 09-27-2013, 10:08 AM
  1. #1
    Registered User
    Join Date
    09-15-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    56

    Is there a way to display all dates in a range of dates?

    e.g.

    12-Jun to 27-Jun <- range of dates


    Print/Display all dates in different cells -> 12 Jun 13 Jun 14 Jun 15 Jun 16 Jun ...... 26 Jun 27 Jun

  2. #2
    Forum Contributor
    Join Date
    09-11-2013
    Location
    Huntsville, AL
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Is there a way to display all dates in a range of dates?

    Sub Calc_Date()
    
    Dim NextDate As Date
    'Set Up Do Loop
    Range("A1").Value = "Date"
    Range("A2").Value = "6/21/2013"
    NextDate = "6/21/2013"
    Do Until NextDate = "6/27/2013"
    
    
    NextDate = NextDate + 1
    
    
    'Find the next empty cell in Column F
    Range("A1").End(xlDown).Offset(1, 0).Value = NextDate
    Column("A:A").Select
    Selection.NumberFormat = "m/d/yyyy"
    
    
    Loop
    End Sub
    Check this out.

    Thanks,

    Gregg

  3. #3
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: Is there a way to display all dates in a range of dates?

    Suppose if your starting date is in Cell A1 and end date is in Cell B1. The following code will display all the dates in the range in column C.

    Sub showdaterange()
    Dim rngdiff As Integer
    Dim strdate As Date
    strdate = Cells(1, 1)
    
    rngdiff = Cells(1, 2) - Cells(1, 1)
        For i = 1 To rngdiff + 1
        Cells(i, 3) = strdate
        strdate = strdate + 1
    Next i
    
    Sheets("sheet1").Range("C:C").NumberFormat = "dd-mmm"
    End Sub
    I hope it helps.

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,411

    Re: Is there a way to display all dates in a range of dates?

    See attached file. Put start and end dates in B1 and B2.

    Hope this helps.

    Pete

    EDIT before submitting:

    Ah, it seems that I can't attach a file. Use B1 and B2 for the start and end dates, and put this formula in C1:

    =IF(OR(B1="",B2=""),"",B1)

    Then put this formula in C2:

    =IF(C1="","",IF(C1+1>$B$2,"",C1+1))

    and copy down as far as you need to.

    Hope this helps.

    Pete

+ 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. Check dates in range either same dates or different dates by formula
    By breadwinner in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-12-2013, 07:42 AM
  2. Display certain information for specific range of dates
    By eshep in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-22-2012, 04:02 PM
  3. [SOLVED] Averaging values if desired dates fall between range of dates
    By gbcpurdue in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-21-2012, 02:51 PM
  4. Replies: 8
    Last Post: 02-27-2009, 06:06 PM
  5. [SOLVED] Toggle a range of Julian dates to Gregorian Dates and Back
    By PSKelligan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-18-2005, 10:06 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