adding date ranges

philmatth

Board Regular
Joined
Oct 6, 2008
Messages
123
Office Version
  1. 2003 or older
Platform
  1. Windows
Hi,

I need to add date ranges that are the dates of every Friday to Sunday for the next 5 years in the date from and date to columns. I also need to add other date ranges such as Friday to Saturday.

Is there a quick way of doing this please?

date-range.gif
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Try

Code:
Sub MyDates()
Dim d As Date
Dim i As Long
d = DateValue(InputBox("Enter first Friday date"))
For i = 0 To 260
    Range("C" & Rows.Count).End(xlUp).Offset(1).Value = d + 7 * i
    Range("D" & Rows.Count).End(xlUp).Offset(1).Value = (d + 7 * i) + 2
Next i
End Sub
 
Upvote 0
Brilliant - thank you!

It also generates the fri-sat dates with a tweak on the +2 value. Just for future input, what value takes it to 2016? How do I alter that for future years after 2016?

Very impressed!
 
Upvote 0
Of course! I looked at that value and it didn't click.

Thank you very much for your time.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,726
Members
452,939
Latest member
WCrawford

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