Hello guys,
I am attempting to calculate the length and qty of horizontal lines on a triangle that are a set distance apart from the bottom. (Wall battens in the gable of a shed) I can use this formula =((Ridge-Eave)-Spacing)/TAN(RADIANS(AngleOfRoof)) but then i need to duplicate that formula this many times ROUNDDOWN((Ridge-Eave)/Spacing,0)
Can this be done in a conventional formula or will it need to be a custom VBA formula in this format?
If it has to be done in VBA what will it look like...? Im only new to it and have found the above code in a workbook i am using!
I am attempting to calculate the length and qty of horizontal lines on a triangle that are a set distance apart from the bottom. (Wall battens in the gable of a shed) I can use this formula =((Ridge-Eave)-Spacing)/TAN(RADIANS(AngleOfRoof)) but then i need to duplicate that formula this many times ROUNDDOWN((Ridge-Eave)/Spacing,0)
Can this be done in a conventional formula or will it need to be a custom VBA formula in this format?
VBA Code:
Public Function ListItemsPrice(Quant As Range, Price As Range)
Dim Qs As New Collection, Ds As New Collection, Ps As New Collection
Dim c As Range, mTotal As Currency
For Each c In Quant
Qs.Add c
Next
For Each c In Price
Ps.Add c
Next
For i = 1 To Qs.Count
If Not Qs(i) = Empty Then
mTotal = mTotal + (Ps(i) * Qs(i))
End If
Next i
ListItemsPrice = mTotal
'just incase selcted ranges are not equal in length
If Not Price.Count = Quant.Count Then
ListItemsPrice = "Range Selection Error"
End If
End Function
If it has to be done in VBA what will it look like...? Im only new to it and have found the above code in a workbook i am using!