Help with Excel VBA QUOTIENT
This seems like it should be easy, but i'm baffled!! In the code below,I want
to put the quotient of Cells E20 and E38, both of which contain positive
integers, into Cell G40. The only value I get is zero. The code runs ok but
obviously produces the wrong result. Can anyone tell me why this is? What am
I missing? Thanks.
Sub ComputeAssetRatios()
Application.Worksheets("AssetAllocation").Activate
Dim Numerator As Range
Dim Denominator As Range
Dim Ratio
Dim x
Dim y
Dim z
Set Numerator = Worksheets("AssetAllocation").Range("E20")
x = Numerator.Value
Debug.Print
Set Denominator = Worksheets("AssetAllocation").Range("E38")
y = Denominator.Value
Debug.Print
Ratio = Application.WorksheetFunction.Quotient(x, y)
Range("G40").Select
Selection.Value = Ratio
Debug.Print
End Sub
|