Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Fill Series question

Status
Not open for further replies.

puforee

Technical User
Oct 6, 2006
741
US
I have a spreadsheet and I need to fill/series dates weekdays. I have done this and stored it as a macro.
Code:
Sub Fill_Right_Dates()
'
' Fill_Right_Dates Macro
'

'
    Selection.DataSeries Rowcol:=xlRows, Type:=xlChronological, Date:= _
        xlWeekday, Step:=1, Stop:=42321, Trend:=False
End Sub

What I would like to do is set the start date to a cell location and the stop date to another cell location. Is this possible and if so can you please show me how it would be coded. In the code above I recorded a macro as I used the Fill Series tool. The Stop date I had to enter manually. I want to automate this process.

Thanks,
 

Disreguard everyone....I figured it out.

Thanks,
 
I am new to this "having an epiphany" thing but here goes.
Code:
Sub Fill_Right_Dates()
'
' Fill_Right_Dates Macro
'

'
    Dim Last_Day As Date
    Last_Day = Range("B3").Value
    'MsgBox Last_Day
    Range("C3").Select

    
    Selection.DataSeries Rowcol:=xlRows, Type:=xlChronological, Date:= _
        xlWeekday, Step:=1, stop:=Last_Day, Trend:=False
End Sub

B3 is where the end of the fill is stored. C3 is where the fill will start.

This code fills right to give me all the weekdays between start and stop. I can use this in a attendance sheet where course length is varriable. The Last Day B3 is automaticall calculate on the sheet based on Course start date and length of course. Then the macro is run off a button.

Thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top