How to eliminate the values that ends with 11 in a column

How to eliminate the values that ends with 11 in a column without linq query.
Using of linq query, in read range its taking more time to read the data so is there any alternatives.

Hi @anjani_priya

Use the below VBA code and give a try:

Sub RemoveRowsEndingWith11()
    Dim ws As Worksheet
    Dim lastRow As Long
    Dim i As Long
    ' Set the worksheet
    Set ws = ThisWorkbook.Sheets("Sheet1")
    ' Find the last row with data in the specified column
    lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
    ' Loop through the rows in reverse order
    For i = lastRow To 1 Step -1
        If Right(ws.Cells(i, "A").Value, 2) = "11" Then
            ws.Rows(i).Delete
        End If
    Next i
End Sub

FLOW:

XAML:
Sequence45.xaml (8.7 KB)

Regards

cant we use in filter activity

Hi, Use this filter table linq query. replace Dt & coloumn name with your actual names.

DT.AsEnumerable().Where(Function(w) not w(“Colomnname”).ToString.Trim.EndsWith(“11”)).CopyToDataTable

yes here it is:

DT.AsEnumerable().Where(Function(w) not w(“Colomnname”).ToString.Trim.EndsWith(“11”)).CopyToDataTable

@anjani_priya

you can use filter activity with endswith

image

cheers

I have tried this but its not filtering

@anjani_priya

can you send a sample excel so that we can check

cheers

@anjani_priya,

If you have very huge file then VBA would be best suited here. If you say you don’t want to use LINQ but want to use Filter activity, then you are defeating your own requirement.

LINQ & Filter activity both will require DataTable and that will be prepared only after reading the data.

Thanks,
Ashok :slight_smile:

Book1.xlsx (44.3 KB)

filter modern activity dont need read range

@anjani_priya ,

Ok you meant Excel Filter. I considered DT Filter :smiley:

1 Like

yes modern activity filter

Hi @anjani_priya

Try this:


Forum.zip (2.1 KB)


Happy Automation :slight_smile:
Cheers!!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.