I am using a VBA macro to extract info from spreadsheet cells operate on them and return the values to a spreadsheet. Each odd numbered item is an angle. The following code works just fine. Is there a way to use a procedure or function to assure the number passed to the cell named Range("item31") is between 0 and 360 degrees.
Range("item30") = Range("item26") * Range("item2")
Range("item31") = Range("item27") + Range("item3")
If Range("item31") < 0 Then Range("item31") = Range("item31") + 360
If Range("item31") > 360 Then Range("item31") = Range("item31") - 360
I did not have any success with the following approach.
MyFunction(Range("item31")) = Range("item27") + Range("item3")
Range("item30") = Range("item26") * Range("item2")
Range("item31") = Range("item27") + Range("item3")
If Range("item31") < 0 Then Range("item31") = Range("item31") + 360
If Range("item31") > 360 Then Range("item31") = Range("item31") - 360
I did not have any success with the following approach.
MyFunction(Range("item31")) = Range("item27") + Range("item3")