Compile error

  • Thread starter Thread starter Learning VBA
  • Start date Start date
L

Learning VBA

I am getting acompile error end with without with on this code.

With Me.Range("B190")
If .Value > 0 Then
ActiveSheet.Tab.ColorIndex = 6
Else
If .Value < 0 Then
ActiveSheet.Tab.ColorIndex = 3
Else
ActiveSheet.Tab.ColorIndex = 0
End If
End With
 
You miss a 'End If' statement

With Me.Range("B190")
If .Value > 0 Then
ActiveSheet.Tab.ColorIndex = 6
Else
If .Value < 0 Then
ActiveSheet.Tab.ColorIndex = 3
End If ' <=====
Else
ActiveSheet.Tab.ColorIndex = 0
End If
End With

Regards,
Per
 
Maybe...

With Me.Range("B190")
If .Value > 0 Then
ActiveSheet.Tab.ColorIndex = 6
Else
If .Value < 0 Then
ActiveSheet.Tab.ColorIndex = 3
Else
ActiveSheet.Tab.ColorIndex = 0
End If
end if
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top