Auto-populate other cells based on dates
An bit of code that creates the starting point of your scenario:
'===============
Sub AutoDates()
Dim StartDate, EndDate As Date
Dim i, x As Integer
'Define the start date
StartDate = Range("A1")
'Number of Days
EndDate = StartDate + 7
'Starting row
x = 2
Do While StartDate <= EndDate
'Number of entries per day
i = 15
Do While i 0
Cells(x, 1).Value = StartDate
i = i - 1
x = x + 1
Loop
StartDate = StartDate + 1
Loop
End Sub
'============
--
Best Regards,
Luke M
*Remember to click "yes" if this post helped you!*
"Freddy" wrote:
Microsoft Visual Basic 6.5 on Microsoft Excel 2002 SP3. I'd like assistance
in writing code to auto-populate other cells based on a column of dates. The
purpose is to determine what slots need to be filled for scheduling purposes.
There are a total of, for example, 15 slots to be filled per date.
Essentially, this is my thought process. I believe each date per row needs to
be evaluated to see where it fits in a scheduling template which would be
created by the user initially selecting a date using a defined name table
then I would have the cells underneath fill in automatically 15 times then
the 16th cell down would be the originally selected date plus one day; this
last step would be repeated to span 7 days. Now, from another worksheet
within the workbook, after sorting records by date, then time, then city, I
would these copy rows into a worksheet named "Scheduler".
|