Hello All
Why do I get a Else Without If error in the below code?
I'm probably blind but I looked at it several time and I dont get it.
Thank you
p.s. The color are all the same. Just did not set them up yet.
Dim btn As Shape
Dim arrayFDE() As String
Dim searchCat As Long
arrayFDE = Split(Range("L" & activeRow).Value, vbLf)
For k = 0 To UBound(arrayFDE)
Set btn = Shapes("Button" & k + 1)
btn.TextFrame.Characters.Text = arrayFDE(k)
searchCat = InStr(1, arrayFDE(k), "(Warning)", vbTextCompare)
If searchCat > 0 Then
With btn.TextFrame.Characters.Font
.Color = RGB(255, 83, 83)
Else
searchCat = InStr(1, arrayFDE(k), "(Status)", vbTextCompare)
If searchCat > 0 Then
With btn.TextFrame.Characters.Font
.Color = RGB(255, 83, 83)
Else
searchCat = InStr(1, arrayFDE(k), "(Advisory)", vbTextCompare)
If searchCat > 0 Then
With btn.TextFrame.Characters.Font
.Color = RGB(255, 83, 83)
Else
searchCat = InStr(1, arrayFDE(k), "(Status)", vbTextCompare)
If searchCat > 0 Then
With btn.TextFrame.Characters.Font
.Color = RGB(255, 83, 83)
Else
searchCat = InStr(1, arrayFDE(k), "(Info)", vbTextCompare)
If searchCat > 0 Then
With btn.TextFrame.Characters.Font
.Color = RGB(255, 83, 83)
End If
End If
End If
End If
End If
Next k
Why do I get a Else Without If error in the below code?
I'm probably blind but I looked at it several time and I dont get it.
Thank you
p.s. The color are all the same. Just did not set them up yet.
Dim btn As Shape
Dim arrayFDE() As String
Dim searchCat As Long
arrayFDE = Split(Range("L" & activeRow).Value, vbLf)
For k = 0 To UBound(arrayFDE)
Set btn = Shapes("Button" & k + 1)
btn.TextFrame.Characters.Text = arrayFDE(k)
searchCat = InStr(1, arrayFDE(k), "(Warning)", vbTextCompare)
If searchCat > 0 Then
With btn.TextFrame.Characters.Font
.Color = RGB(255, 83, 83)
Else
searchCat = InStr(1, arrayFDE(k), "(Status)", vbTextCompare)
If searchCat > 0 Then
With btn.TextFrame.Characters.Font
.Color = RGB(255, 83, 83)
Else
searchCat = InStr(1, arrayFDE(k), "(Advisory)", vbTextCompare)
If searchCat > 0 Then
With btn.TextFrame.Characters.Font
.Color = RGB(255, 83, 83)
Else
searchCat = InStr(1, arrayFDE(k), "(Status)", vbTextCompare)
If searchCat > 0 Then
With btn.TextFrame.Characters.Font
.Color = RGB(255, 83, 83)
Else
searchCat = InStr(1, arrayFDE(k), "(Info)", vbTextCompare)
If searchCat > 0 Then
With btn.TextFrame.Characters.Font
.Color = RGB(255, 83, 83)
End If
End If
End If
End If
End If
Next k