I have a UDF that makes a calculation based on a bunch of input variables. I am trying to make the UDF create a cell comment that contains information about those variables, but I am just getting the #VALUE! error.
This is what I am trying to do:
Function profit(income As Single, loss As Single) As Single
Dim cell As Range
cell = ActiveCell
profit = income - loss
call create_comment(cell, income, loss)
End function
Calling the sub:
Private Sub create_comment(cell As Range, income As Single, loss As Single)
cell.ClearComments
cell.Addcomment "income =" & income & "loss =" & loss
End Sub
All help appreciated!