Hello,
i would like to ask for help with the following VBA code. I need to write a funciton that multiplies or divides a matrix in Excel by a double value. I want to call the function like
where B2:C3 is an example of some selected area with double values. Of course, area of the same size is selected when the function is executed. I just keep getting #Value! error.
Function MatrixMultiply(ByRef area As Range) As Variant()
Dim MultiplyNumber As Double
Dim i As Integer
Dim MatrixResult As Range
MultiplyNumber = 2
MatrixResult = area.Value
For i = 0 To area.Cells.Count
MatrixResult(i) = area(i) * 2
Next i
'other approach
'For Each cellItem In normVect
' cellItem.Value = cellItem * 2
'Next cellItem
MatrixMultiply = MatrixResult
End Function
Thanks for any ideas,
David
Bookmarks