montecarlo2012
Well-known Member
- Joined
- Jan 26, 2011
- Messages
- 986
- Office Version
- 2010
- Platform
- Windows
Hello everyone.
I am trying to add two columns, A2:A34 result in C2, B2:B34 result in D2 and C2/D2 in F2. my problem now is that SOMETIMES I don't need to input values on A2:A34 and I just want the results of column B, so I write this code, but I don't figure It out the condition for empty column, here is my code.
I am trying to add two columns, A2:A34 result in C2, B2:B34 result in D2 and C2/D2 in F2. my problem now is that SOMETIMES I don't need to input values on A2:A34 and I just want the results of column B, so I write this code, but I don't figure It out the condition for empty column, here is my code.
HTML:
Private Sub CommandButton1_Click()
Range("C2").Value = WorksheetFunction.Sum(Range("A2:A34"))
Range("D2").Value = WorksheetFunction.Sum(Range("B2:B34"))
Range("F2").Value = Range("D2").Value / Range("C2").Value
If Range("A2:A34") = 0 Then
Range("C2") = 0
End If
If Range("F2") > 4.8 Then
MsgBox "your rick is to hight, be carefull if there are more than 25 rolls"
End If
End Sub