Sharism
12-07-2018, 06:22 AM
Hello guys,
just wanted to as if you could help me.
• Your macro will do some basic calculation for rectangles
• First the user enters length and width of the triangle
• Then the user enters what kind of calculation has to be done
1: circumfence
2: area
3: the length of the diagonal
• If the user chooses an invalid calculation a message has to be displayed
• Show the result of the calculation in a message box
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(0, 0) = "G12" Then
Select Case Target.Value
Case "circumfence"
Range("H14").FormulaR1C1 = "=2*(R[-2]C[-6]+R[-1]C[-6])"
Case "area"
Range("H14").FormulaR1C1 = "=R[-2]C[-6]*R[-1]C[-6]"
Case "diagonal"
Range("H14").FormulaR1C1 = "=SQRT(SUMSQ(R[-2]C[-6]:R[-1]C[-6]))"
Case Else
Range("H14").Value = ""
End Select
End If
End Sub
I did it like this, but it is false because there is no message box. So I wanted to know, how I transform this into the message box?
Many thanks
just wanted to as if you could help me.
• Your macro will do some basic calculation for rectangles
• First the user enters length and width of the triangle
• Then the user enters what kind of calculation has to be done
1: circumfence
2: area
3: the length of the diagonal
• If the user chooses an invalid calculation a message has to be displayed
• Show the result of the calculation in a message box
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(0, 0) = "G12" Then
Select Case Target.Value
Case "circumfence"
Range("H14").FormulaR1C1 = "=2*(R[-2]C[-6]+R[-1]C[-6])"
Case "area"
Range("H14").FormulaR1C1 = "=R[-2]C[-6]*R[-1]C[-6]"
Case "diagonal"
Range("H14").FormulaR1C1 = "=SQRT(SUMSQ(R[-2]C[-6]:R[-1]C[-6]))"
Case Else
Range("H14").Value = ""
End Select
End If
End Sub
I did it like this, but it is false because there is no message box. So I wanted to know, how I transform this into the message box?
Many thanks