Hi,
I have the following code. I think I have the syntax correct but somehow I got error message: Compile error: Else without If. Not sure why. Wonder if someone could help point out the problem?
I have the following code. I think I have the syntax correct but somehow I got error message: Compile error: Else without If. Not sure why. Wonder if someone could help point out the problem?
Code:
finalRow = sht.Cells(sht.Rows.Count, "a").End(xlUp).Row
finalRow_minMax = sht_minMax.Cells(sht.Rows.Count, "a").End(xlUp).Row
For i = 2 To finalRow
If Cells(i, 14).Value >= 0 Then
Bucket = Cells(i, 14).Value
Select Case Bucket
Case 50
Cells(i, 15).Value = Cells(i, 5).Value + 0.001
Case 40
Cells(i, 15).Value = Cells(i, 5).Value + 0.002
Case 30
Cells(i, 15).Value = Cells(i, 5).Value + 0.003
Case 20
Cells(i, 15).Value = Cells(i, 5).Value + 0.004
Case 10
Cells(i, 15).Value = Cells(i, 5).Value + 0.005
Case 0
Cells(i, 15).Value = Cells(i, 5).Value + 0.006
Else
Select Case Bucket
Case -10
Cells(i, 15).Value = Cells(i, 5).Value - 0.001
Case -20
Cells(i, 15).Value = Cells(i, 5).Value - 0.002
Case -30
Cells(i, 15).Value = Cells(i, 5).Value - 0.003
Case -500
Cells(i, 15).Value = Cells(i, 5).Value - 0.004
End Select
End If
Next