Hi,
I have written a function code to concatenate strings and formula, which is failing after so many attempts.
Function CAT_SUM(a As Integer, b As Integer)
CAT_SUM = a - b
If CAT_SUM.Value < 0 Then
ActiveCell = "the percentage has decreased by " & CAT_SUM & ""
Else
ActiveCell = "the percentage has increased by " & CAT_SUM & ""
End If
End Function
The aim behind this code is that if I subtract A2:A65536 cell value and B2:B65536 cell value, based on the result (positive or negative) it should display in C2:C65536 value as "The value has increased by " the value" (if it is positive") or "The value has decreased by " the value" (if it is negative"), the function formula should apply to all the cells starting from C2 (depends if the value is there in A and B cells).
Please assist me in the code using function
I have written a function code to concatenate strings and formula, which is failing after so many attempts.
Function CAT_SUM(a As Integer, b As Integer)
CAT_SUM = a - b
If CAT_SUM.Value < 0 Then
ActiveCell = "the percentage has decreased by " & CAT_SUM & ""
Else
ActiveCell = "the percentage has increased by " & CAT_SUM & ""
End If
End Function
The aim behind this code is that if I subtract A2:A65536 cell value and B2:B65536 cell value, based on the result (positive or negative) it should display in C2:C65536 value as "The value has increased by " the value" (if it is positive") or "The value has decreased by " the value" (if it is negative"), the function formula should apply to all the cells starting from C2 (depends if the value is there in A and B cells).
Please assist me in the code using function
Last edited: