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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

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