If and End with

Apple08

Active Member
Joined
Nov 1, 2014
Messages
450
Hi everyone

There is an error 'End if without block if' with the code below:

Please could anyone help.

Code:
[FONT=Calibri][SIZE=3][COLOR=#000000]Sub RemoveRows()[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]    Sheet1.Select[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]    Dim x As Long,LastRow As Long[/COLOR][/SIZE][/FONT]

[FONT=Calibri][SIZE=3][COLOR=#000000]    LastRow = Cells(Rows.Count,"A").End(xlUp).Row[/COLOR][/SIZE][/FONT]

[FONT=Calibri][SIZE=3][COLOR=#000000]    For x = LastRow To2 Step -1[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]        If Cells(x,3).Value <> "FASS" And Cells(x, 3).Value <>"FBL" And Cells(x, 3).Value <> "LTI-A" And Cells(x,3).Value <> "STEM" _[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]            AndCells(x, 3).Value <> "STEM" And Cells(x, 3).Value <>"MOOC FASS" And Cells(x, 3).Value <> "ApprentFBL" AndCells(x, 3).Value <> "ApprentSTEM" _[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]            AndCells(x, 3).Value <> "PG FutureLearn" And Cells(x, 3).Value<> "MA Non-project" And Cells(x, 3).Value <>"Student Hub Live" _[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]            AndCells(x, 3).Value <> "Editorial" And Cells(x, 3).Value <>"Editorial (Maintenance)" And Cells(x, 3).Value <>"Graphics" _[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]            AndCells(x, 3).Value <> "IMD" And Cells(x, 3).Value <>"Learning Design" Then _[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]           Rows(x).Delete[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]        End If[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]    Next x[/COLOR][/SIZE][/FONT]

[FONT=Calibri][SIZE=3][COLOR=#000000]End Sub[/COLOR][/SIZE][/FONT]
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Remove the last underscore (_)
And Cells(x, 3).Value <> "IMD" And Cells(x, 3).Value <>"Learning Design" Then
_
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,923
Members
448,533
Latest member
thietbibeboiwasaco

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