Hi all,
I'm having a bit of a night mare. with some simple code that you lot will no doubt be able to fix instantly. The code is simple:
Dim time As Integer, result As String
time = Range("K3").Value
If time > Range("k15") Then MsgBox "K3 value exceeds total time of test. Lower value"
time = Range("K4").Value
If time > Range("k15") Then MsgBox "K4 value exceeds total time of test. Lower value"
time = Range("K5").Value
If time > Range("k15") Then MsgBox "K5 value exceeds total time of test. Lower value"
time = Range("K6").Value
If time > Range("k15") Then MsgBox "K6 value exceeds total time of test. Lower value"
time = Range("K7").Value
If time > Range("k15") Then MsgBox "K7 value exceeds total time of test. Lower value"
time = Range("K8").Value
If time > Range("k15") Then MsgBox "K8 value exceeds total time of test. Lower value"
time = Range("K9").Value
If time > Range("k15") Then MsgBox "K9 value exceeds total time of test. Lower value"
time = Range("K10").Value
If time > Range("k15") Then MsgBox "K10 value exceeds total time of test. Lower value"
time = Range("K14").Value
If time > Value = 500 Then MsgBox "K14 value exceeds recommended lag limit. Lower value"
I want the sub to exit if the conditions are met. i.e if the msgbox is activated then the sub exits and if the msgbox is not activated to carry on.
I've looked everywhere but keep getting errors something like "can't block if without if" and others.
Please help!
Thank you for your time
I'm having a bit of a night mare. with some simple code that you lot will no doubt be able to fix instantly. The code is simple:
Dim time As Integer, result As String
time = Range("K3").Value
If time > Range("k15") Then MsgBox "K3 value exceeds total time of test. Lower value"
time = Range("K4").Value
If time > Range("k15") Then MsgBox "K4 value exceeds total time of test. Lower value"
time = Range("K5").Value
If time > Range("k15") Then MsgBox "K5 value exceeds total time of test. Lower value"
time = Range("K6").Value
If time > Range("k15") Then MsgBox "K6 value exceeds total time of test. Lower value"
time = Range("K7").Value
If time > Range("k15") Then MsgBox "K7 value exceeds total time of test. Lower value"
time = Range("K8").Value
If time > Range("k15") Then MsgBox "K8 value exceeds total time of test. Lower value"
time = Range("K9").Value
If time > Range("k15") Then MsgBox "K9 value exceeds total time of test. Lower value"
time = Range("K10").Value
If time > Range("k15") Then MsgBox "K10 value exceeds total time of test. Lower value"
time = Range("K14").Value
If time > Value = 500 Then MsgBox "K14 value exceeds recommended lag limit. Lower value"
I want the sub to exit if the conditions are met. i.e if the msgbox is activated then the sub exits and if the msgbox is not activated to carry on.
I've looked everywhere but keep getting errors something like "can't block if without if" and others.
Please help!
Thank you for your time