Trying to enter cell value in excel but the code is giving value error. Can't under stand why. The subroutine "write_cell" runs fine if there is no argument with it but gives error if there is any argument
Function Clone_test(num As Integer) As Integer
Dim rng As Range
Dim result As Integer
Set rng = Range("B4")
write_cell rng, num
result = num
Clone_test = Cells(4, "D").Value
End Function
Private Sub write_cell(ByRef cell_rng As Range, ByVal n As Integer)
Dim rng As Range
Set rng = cell_rng
rng.Value = 45 '**this line is creating problems**
MsgBox n
End Sub