I am trying to figure out how to utilize a error trap for my macro.
The basic idea is as follows:
For Each c In rng
If c.Value = "Week" Then
If c.Offset(0, 2).Value > 0 Then
If c.Offset(0, 2).Value < Range("$A$20").Value Then
c.Offset(0, 3) = "1"
ElseIf sum of the 24 cells above c.offset(0,2)=0
Run this code
ElseIf sum of the 19 cells above c.offset(0,2)=0
Run this code
ElseIf sum of the 14 cells above c.offset(0,2)=0
Run this code
ElseIf sum of the 9 cells above c.offset(0,2)=0
Run this code
Else
Run this code
End If
End If
End If
Next c
I am trying to test for the least likely to most likely scenario. The problem is that the code errors out on the first elseif statement. I am not 25 rows down the sheet when the first condition is met so I get the error.
In a perfect world - I would use something like On error resume next elseif. Of course we all know this is not a perfect world.
Any idea's?
Thanks,
Kurt
The basic idea is as follows:
For Each c In rng
If c.Value = "Week" Then
If c.Offset(0, 2).Value > 0 Then
If c.Offset(0, 2).Value < Range("$A$20").Value Then
c.Offset(0, 3) = "1"
ElseIf sum of the 24 cells above c.offset(0,2)=0
Run this code
ElseIf sum of the 19 cells above c.offset(0,2)=0
Run this code
ElseIf sum of the 14 cells above c.offset(0,2)=0
Run this code
ElseIf sum of the 9 cells above c.offset(0,2)=0
Run this code
Else
Run this code
End If
End If
End If
Next c
I am trying to test for the least likely to most likely scenario. The problem is that the code errors out on the first elseif statement. I am not 25 rows down the sheet when the first condition is met so I get the error.
In a perfect world - I would use something like On error resume next elseif. Of course we all know this is not a perfect world.
Any idea's?
Thanks,
Kurt