End If without block If

SBF12345

Well-known Member
Joined
Jul 26, 2014
Messages
614
I am receiving the end if without block if compile error in the below chunk of code. The initial IF clause is definitely not missing, so I'm guessing the nested IF is "separated" from the End If that is returning the error. What part of the code between the outer IF-End If is preventing the recognition of this statement?

Code:
If Cells(bb, 4).value < Cells(dd, 4).value - NumObs Or Cells(bb, 4).value > Cells(dd, 4).value + NumObs Then        
        If Cells(bb, 3) <= Cells(dd, 3) Then Rows(dd).EntireRow.Delete
            Else: Rows(bb).EntireRow.Delete
        End If
        
    End If

Thanks!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Too many IF's

Code:
If Cells(bb, 4).Value < Cells(dd, 4).Value - NumObs Or Cells(bb, 4).Value > Cells(dd, 4).Value + NumObs Then
        If Cells(bb, 3) <= Cells(dd, 3) Then Rows(dd).EntireRow.Delete
            Else: Rows(bb).EntireRow.Delete
        End If

Also, make sure you have dimmed your variables....dd and bb are both Integer
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top