ByRef value not returned to the speadsheet
your last line doesn't return the adjusted date - change it to what I have
in the following code:
Function SetCompletionDate(CompletionDate As Date) As Date
' Correct value for CompletionDate is displayed via debug.print
Debug.Print "1:" & CompletionDate
' Correct value for CompletionDate is displayed via debug.print
' but the value on the spreadsheet is not changed
CompletionDate = CompletionDate + 10
Debug.Print "2:" & CompletionDate
' Correct value is returned to the speadsheet
SetCompletionDate = CompletionDate '' AMENEDED LINE
End Function
"Bruce A. Julseth" wrote in message
...
The argument, CompletionDate, is a reference to a cell (R7). I add 10 to
CompletionDate.
Debug.Print, in both cases, displays the correct value but my cell (R7) is
not updated.
My function resides in cell U7 and it's value is returned correctly.
What am I doing wrong? Thanks for the the help.
Function SetCompletionDate(CompletionDate As Date) As Date
' Correct value for CompletionDate is displayed via debug.print
Debug.Print "1:" & CompletionDate
' Correct value for CompletionDate is displayed via debug.print
' but the value on the spreadsheet is not changed
CompletionDate = CompletionDate + 10
Debug.Print "2:" & CompletionDate
' Correct value is returned to the speadsheet
SetCompletionDate = Now() + 10
End Function
|