I'm new to VBA and I have this sub that calculates the perimeter and area of rectangle. It should pass the length, breadth and perimeter as parameters. Then I need to call this sub from another sub and use debug.print to display the result in immediate window. This is the code I have:
[VBA]Sub Rectangle(ByVal Area As Double, ByVal Perimeter As Double, ByVal Length As Double, ByVal Breadth As Double)
Area = Length * Breadth
Perimeter = (Length + Breadth) * 2
End Sub
Sub ShowResult()
Call Rectangle(Area, Perimeter, 3, 5)
Debug.Print "Length=" & Length & "Breadth=" & Breadth & "Area=" & Area & "Perimeter=" & Perimeter
End Sub[/VBA]
It gives error, I can't figure out how to do it after a day of researching on the web.
Can anyone pls help and give some hint, thanks.