View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
David
 
Posts: n/a
Default Custom fill series?

Need to modify Case statements:

Select Case Day(mdate)
Case 1, 21, 31: x = "st"
Case 2, 22: x = "nd"
Case 3, 23: x = "rd"
Case Else: x = "th"
End Select

--
David

Don Guillett wrote

If you liked the formula you will really like this. Position the
cursor where you want the dates to start. Execute the macro. You will
be asked for the first date and the number of weeks desired.

Sub datefillcustom()
ac = ActiveCell.Column
ar = ActiveCell.Row - 1
md = InputBox("Enter date like 01/28/06")

If Not IsDate(md) Then
MsgBox "Start Over"
Exit Sub
End If

mdate = DateSerial(Year(md), Month(md), Day(md))
For i = 1 To InputBox("Enter number of weeks desired")
Select Case Day(mdate)
Case 1: x = "st"
Case 2: x = "nd"
Case 3: x = "rd"
Case Is 3: x = "th"
Case Else
End Select
Cells(ar + i, ac).Value = Day(mdate) & x & Format(mdate, " mmm, yyyy")
mdate = mdate + 7
Next i