I have a function written in a module and i call ths function from mutiple rows .I have the Following Function which return a value. I want the value to be written into Sheet2 instead of displaying in the cell from which the function is called
For every returned value , the output should get written to the next row in sheet2
Dim curRow As Variant
Function sellbuy(high, low As Variant) As Variant
Dim a As Variant
Dim Totalhigh As Variant
Dim highmult As Variant
Dim resulthigh As Variant
Dim resultlow As Variant
Dim row As Variant
resulthigh = high
resultlow = low
'result = (high Mod 10) + Int(high / 10)
curRow = Application.Caller.row
If resulthigh = 6 Or resulthigh = 20 Then
'MsgBox "Sell " & "" & Cells(ActiveCell.row, 2)
sellbuy = "Sell" & " " & Cells(curRow, 2) & " " & "High " & Cells(curRow, 15) & " " & Time
End If
If resultlow = 6 Or resultlow = 20 Then
'MsgBox "Sell " & " " & Cells(ActiveCell.row, 2)
sellbuy = "Buy" & " " & Cells(curRow, 2) & " " & "Low " & Cells(curRow, 16) & " " & Time
End If
End Function
The Sellbuy value should be written in sheet2 . For every Sellbuy value returned the value must be written in next row of sheet 2
Bookmarks