0 down vote favorite
1
I would greatly appreciate your assistance in helping me write data from a custom VBA function into an excel worksheet. I have been able to write from a custom VBA subroutine but get an error whilst executing a VBA function. In the sample code, "Sub write 2" and "Sub write 3" work just fine. But "Function test 2()" generates "Value!" in its cell and write3 isn't executed.
Sub write2(r As Integer, c As Integer, d As Double)
Dim a, b As Integer
For a = r To r + 1
For b = c To c + 1
Cells(a, b).Value = d
Next b
Next a
End Sub
Sub write3()
Call write2(3, 60, 0.437)
End Sub
Function test2() As Double
Call write3
test2 = 1#
End Function
Bookmarks