View Single Post
  #15 (permalink)  
Old 08-07-11, 22:06
mcwsky09 mcwsky09 is offline
Registered User
 
Join Date: Aug 2011
Posts: 1
you need an additional End If

Quote:
Originally Posted by CathyMe View Post
Please help, I am really new to vb I got a compile error saying "Block If Without End If"
and everytime I try correcting it, it still gives me the same error and End Sub is highlighted...I am working with Option buttons which I am new to. Here's the code:

If optRateA.Value = True Then
intGross = intHours * optRateA
Else
If optRateB.Value = True Then
intGross = intHours * optRateB
Else: optRateC.Value = True
intGross = intHours * optRateC
End If

Please help me!

this is an older post so maybe you have already figured it out but you have two IF statements - so you need two End IF statements - logically the nested IF statemtent is part of the same process so you ay have been thinking you are doing End If on the whole block - but the code requires an End If to match each one.

I am trying to solve my own compile error - but have about 5 nested IF statements - It looks like I have enough end ifs - unless I am looiking in the wrong place - keep in mind that you only need an End If after a block IF in other words a single like such as:

if true = true then msgbox ("True")

does NOT need an End If

whereas

if true = true then
msgbox ("True")
truth = true
End If

DOES need an End If

thing that annoys me on my issue is that I coudl have sworn I solved it earlier today and saved it - but it came back - so somewhere along the way I did not get some of my work earlier today saved.
Reply With Quote