fill series using from-to date range? (October 4-17, 2020, etc.)

chraco

New Member
Joined
Sep 24, 2014
Messages
11
Hi, I can't find anything about filling a series of dates, based on a format such as October 4-17, 2020, October 18-31, 2020, etc. Clearly, the auto-fill utility is no help, so I'm guessing a formula is in order. Any takers?

Thanks!
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
VBA Code:
Sub AutoDateFill()
    Dim x As Date
    Dim rn As Long
    Dim cn As String, sn As Long
    cn = InputBox("Which Column to fill?")
    
    
    rn = InputBox("How many rows to fill?")
    sn = InputBox("Which row to start fill?")

    Application.ScreenUpdating = False
    Application.StatusBar = "Macro Running"
    x = InputBox("What is the starting Date? mm/dd/yyyy")
    Range(cn & sn).Select
    Do Until ActiveCell.Row = rn + sn
        If ActiveCell.EntireRow.Hidden = False Then
            ActiveCell.Value = x
            x = x + 1
        End If
        ActiveCell.Offset(1).Select
    Loop
    Application.ScreenUpdating = True
    Application.StatusBar = "Completed"
End Sub
 
Upvote 0
Thanks alansidman! However, the code just filled a sequential series of single dates, exactly as if I'd grabbed the auto-fill handle and dragged down.

That's all right, I just typed my list in manually. There were only about 30 cells to fill and this issue only comes up a few times per year. Although it's an interesting problem, it's probably not worth solving. The effort to benefit ratio seems too high.

Thanks anyway!
 
Upvote 0
It looks like you're trying to do this:
Cell Formulas
RangeFormula
B6:B16B6=SUM(B5,14)
D5:D16D5=TEXT(B5,"mmmm d-") & TEXT(B5+13,"d, yyyy")


But what happens when the end date is in another month? 29th Nov - 12th Dec for instance.
 
Upvote 0
Thanks Darren, I appreciate your post and your approach is clever. But as you noted, there's still a problem to solve when a cell contains a range spanning two months.

If I had to do this every day, or on a project that required 1,000 cells to be filled, it might be worth pursuing. But I suspect the solution to this problem requires too much code to wrangle for my occasional and relatively simple needs.

Thanks for your time everyone, I appreciate it.
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,377
Members
448,955
Latest member
BatCoder

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top