Excel 2007
I need to put a value into a known column for the caller's row...
Function ProjectDaysThisMonth(theDate As Date) As Double
Dim d1 As Date
Dim d2 As Date
Dim rngCaller As Range
' start and end of month
d1 = theDate - Day(theDate) + 1
d2 = Application.EoMonth(d1, 0)
' where-ever this function was called from the sheet
Set rngCaller = Application.Caller
...
' workdays_thismonth was set to the # of days of month from where this function was called on the sheet
' remaining_days was set to previous months work and work done this month
' now once you're in a certain certain scenario
' put the finish date into a known column for this row:
Worksheets("Plan").Cells(rngCaller.Row, 4).value = DateAdd("d", workdays_thismonth + remaining_days, d1)
' above, she blows up good... no worky
...
End Function
When I try to set the value of another cell, it simply falls apart. Should I use the Evaluate function? Something like...
rngCaller.Parent.Evaluate "setValue(" & rngCaller.Address(False, False) & "," & newDateValue & ")"
Or is there a cleaner way??