- Joined
- Nov 1, 2010
- Messages
- 1
- Reaction score
- 0
I want to build a VBA code with if then statement and the to show a msgbox when the condition is true. my code is
Sub momen()
Dim cp As Range, opp As Range, n As Long
Dim i As Long
Set cp = Range("A2:A11955")
Set opp = Range("B2:B11955")
n = 5
CMO_1 cp, opp, n
i = 0
For i = 1 To 30
If opp(n + 1, 2).Value = -50 Then
MsgBox ("SHORT at time " & i)
End If
Next i
End Sub
when the below range is -50 I want to show a msgbox.
opp(n + 1, 2).Value = "=SUM(" & sumrange & ")/(SUMIF(" & sumrange & "," & """>0"")+abs(sumif(" & sumrange & "," & """<0"")))*100"
Thanks
Sub momen()
Dim cp As Range, opp As Range, n As Long
Dim i As Long
Set cp = Range("A2:A11955")
Set opp = Range("B2:B11955")
n = 5
CMO_1 cp, opp, n
i = 0
For i = 1 To 30
If opp(n + 1, 2).Value = -50 Then
MsgBox ("SHORT at time " & i)
End If
Next i
End Sub
when the below range is -50 I want to show a msgbox.
opp(n + 1, 2).Value = "=SUM(" & sumrange & ")/(SUMIF(" & sumrange & "," & """>0"")+abs(sumif(" & sumrange & "," & """<0"")))*100"
Thanks