ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Scheduling Calendar (https://www.excelbanter.com/excel-programming/282014-excel-scheduling-calendar.html)

Shelia[_2_]

Excel Scheduling Calendar
 
Hi, thanks in advance - I am suffering from poor math
skills late at night.

I am trying to write a piece of code that goes into an
excel calendar I have created and maps (visually) tasks
and events over dates. I have a seperate sheet that lists
tasks and their respective dates.

I am fine with taksks that start in one montha and do not
corssover into other months, but once they start
overlapping I run into errors. The math I am trying to do
relies on the cell value - as the cell is the number of
the day in the month (ie, if a task starts of Jan 28th and
ends on Jan 29th it shows up on Jan 28th and 29th) When a
task spans Jan 28th to Feb 2nd the whole sheet barfs...
any ideas? (ps CurMonth is the current month the user is
looking at)

If Month(StartDate) < CurMonth Then
' Do nothing if the current task does not
start in the current month
Else
' Find the calendar days within the current
schedule tasks Start and End Dates
For Each cell In Worksheets
("calendar").Range("a3:g12")
If ((cell.Value = Day(DateValue
(StartDate))) And ((cell.Value <= Day(DateValue(EndDate))
And Month(DateValue(EndDate)) = CurMonth) Or (cell.Value
= Day(DateValue(EndDate)) And Month(DateValue(EndDate))

CurMonth))) Then
' If cell.Value = Day(DateValue
(StartDate)) And cell.Value <= Day(DateValue(EndDate)) Then
' If the current calander day
(cell.Value) falls in the current task Start and End dates,
' add the ProjectName and
ActivityType to the cell below the current calendar day
cell.
' If the current calendar day cell
already has something in it, concatenate to it,
' otherwise, add the project name
and activity to the calendar cell under the day
' (i.e. cell.Offset(1,0)).
If cell.Offset(1, 0).Value < ""
Then
cell.Offset(1, 0).Value =
cell.Offset(1, 0).Value & Chr(10) & Chr(10) & ProjectName
& Chr(10) & ActivityType
Else
cell.Offset(1, 0).Value =
ProjectName & Chr(10) & ActivityType
End If
Else
' do nothing - i.e. move to the
next cell in the calendar
End If
Next
End If


All times are GMT +1. The time now is 02:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com