h3artablaze
New Member
- Joined
- Aug 28, 2024
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
Hi,
Just to preface, I'm very new to VBA so not sure if starting in the right place here. I'm trying to get a VBA error message to pop up depending on value in cell F5. If F5 = Q5 I'd like "Take Profit Level has been reached" to appear, whereas if F5=R5 I'd like "Stop/Loss Level has been reached" to appear. F5 is a changing value dependent on a function.
Private Sub Calculate(ByVal Target As Range)
If Target.Address = "$F$5" Then
If Target.Value = "$Q$5" Then MsgBox "Take Profit Level has been reached"
If Target.Value = "$R$5" Then MsgBox "Stop/Loss Level has been reached"
End If
End Sub
I went with the above after some light research but clearly is wrong...
Many thanks in advance
Just to preface, I'm very new to VBA so not sure if starting in the right place here. I'm trying to get a VBA error message to pop up depending on value in cell F5. If F5 = Q5 I'd like "Take Profit Level has been reached" to appear, whereas if F5=R5 I'd like "Stop/Loss Level has been reached" to appear. F5 is a changing value dependent on a function.
Private Sub Calculate(ByVal Target As Range)
If Target.Address = "$F$5" Then
If Target.Value = "$Q$5" Then MsgBox "Take Profit Level has been reached"
If Target.Value = "$R$5" Then MsgBox "Stop/Loss Level has been reached"
End If
End Sub
I went with the above after some light research but clearly is wrong...
Many thanks in advance