isittheweekend
New Member
- Joined
- Oct 9, 2014
- Messages
- 2
Am trying to set up a spreadsheet such that when a student enters the correct formula into cell G4 for Pythagoras given values in E4 and F4 a message box let them know if their formula is correct.
Am new to VBA, so any help appreciated.
Sub Pythag()
Dim Formula As String, result As String
Formula = Worksheets("Sheet1").Range("G4").Value
If Formula = ("=SQRT(E4^2+F4^2)") Then
result = "Well done."
Else
result = "Please try again."
End If
MsgBox result
End Sub
Am new to VBA, so any help appreciated.
Sub Pythag()
Dim Formula As String, result As String
Formula = Worksheets("Sheet1").Range("G4").Value
If Formula = ("=SQRT(E4^2+F4^2)") Then
result = "Well done."
Else
result = "Please try again."
End If
MsgBox result
End Sub