Hello vba/excel gurus out there:
I am using EXCEL 2003. I have worksheet, column A has date and time (e.g. 31/10/2014 3:00:00 PM). Working hours are 10am to 4pm (Monday-Friday), every date is repeated with increment of one hour. Then we plot graph/charts based on data.
What I want is read last row of data (read date and time from last row in column A50 for example: 31/10/2014 3:00:00 PM), then add one hour and put it in next cell of column A e.g. A51: 31/10/2014 4:00:00 PM and after 4pm, turn to next date/workday and start adding from 9am and put value in next cell: A52 e.g. 01/11/2014 10:00:00 AM. Repeat this process until specified in cell: F2=20. We do this for future projections to expect the completion time and date within working days. It should exclude weekend and stat holidays.
Here I have function, that just does job without time and only considering dates but I am unable to make it work with time. Any help would be appreciated.
Thanks
Ria
I am using EXCEL 2003. I have worksheet, column A has date and time (e.g. 31/10/2014 3:00:00 PM). Working hours are 10am to 4pm (Monday-Friday), every date is repeated with increment of one hour. Then we plot graph/charts based on data.
What I want is read last row of data (read date and time from last row in column A50 for example: 31/10/2014 3:00:00 PM), then add one hour and put it in next cell of column A e.g. A51: 31/10/2014 4:00:00 PM and after 4pm, turn to next date/workday and start adding from 9am and put value in next cell: A52 e.g. 01/11/2014 10:00:00 AM. Repeat this process until specified in cell: F2=20. We do this for future projections to expect the completion time and date within working days. It should exclude weekend and stat holidays.
Here I have function, that just does job without time and only considering dates but I am unable to make it work with time. Any help would be appreciated.
Code:
Sub FLDDateExtentionH() '**FLD HOURLY**
Dim FLD_Count As Integer, I As Integer, LR As Long, LRDate As Date
Application.ScreenUpdating = False
FLD_Count = ActiveSheet.Range("F2").Value
LR = ActiveSheet.Range("A" & Rows.count).End(xlUp).Row
LRDate = ActiveSheet.Range("A" & LR).Value
' Begin the loop.
For I = 1 To FLD_Count
ActiveSheet.Range("A" & LR + I) = Workday(LRDate, I, Worksheets("Holidays").Range("A1:A5000) 'EXCLUDES WEEKEND & HOLIDAYS
Next I
Application.ScreenUpdating = True
End Sub
Thanks
Ria