Row removed based on criteria

Important Notice

Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.

  • I have this code that I wrote to remove all rows across all sheets that have the text, actual:, in it but doesn't work. Keep getting the error Next without for, but not sure where exactly to edit it.

    Sub Removetextrow()[/FONT][/COLOR][COLOR=black][FONT=Verdana] [/FONT][/COLOR][COLOR=black][FONT=Verdana] Dim WS As Worksheet Application.ScreenUpdating = False    Application.Calculation = xlCalculationManual   For Each WS In ActiveWorkbook.Worksheets       With WSWith WS.UsedRange[/FONT][/COLOR][COLOR=black][FONT=Verdana]Do        Cells.Find(What:="Actual:", After:=ActiveCell, LookIn:=xlValues, LookAt _        :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _        False, SearchFormat:=False).Activate    Selection.EntireRow.DeleteLoop[/FONT][/COLOR][COLOR=black][FONT=Verdana]   End With    Next WS    Application.ScreenUpdating = True    Application.Calculation = xlCalculationManualEnd Sub

    Any help will be greatly appreciated.

  • Re: Row removed based on criteria

    Quote from jproffer;603205

    You're missing an End With after the other End With and before "Next WS"

    Okay thanx that helped but now I just need to find out a way to get over the next error/ hurdle, which is run time error 91, object variable or with block variable not set

  • Re: Row removed based on criteria

    Try this one:

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!