filteredRows=(From row In dtInput.AsEnumerable()
Let value = row.Field(Of String)("A")
Where value.StartsWith("N") OrElse value.StartsWith("L")
Select row).CopyToDataTable()
I’m achieving this from linq query,but my question is there any excel activity in UiPath to save time,because the sheet is taking more time to extract as it contains macro and formulas
Yes I changed,
One clarification I need, is this vb code deletes the complete row or the cell…?
I need to delete the cell of particular column
Which is except starts with N and L
If you n number of columns if some cell does not start with N .You said you have to delete it means the below cell will become the cell Now.For example the bot deletes 2 nd column 3rd row then 2 nd column 4th row will become the 2 nd column 3rd…? or 2 nd column 3rd row will become empty…?between these two cases which case you want
To shift the cell contents up after clearing them, you can use the xlShiftUp parameter with the Delete method of the Range object
Sub Delete_cell()
Dim ws As Worksheet
Dim lastRow As Long
Dim cell As Range
Dim colIndex As Long
' Set the worksheet and column index
Set ws = ThisWorkbook.Worksheets("Sheet2") ' Change "Sheet1" to your sheet name
colIndex = 1 ' Column A
' Find the last row in the column
lastRow = ws.Cells(ws.Rows.Count, colIndex).End(xlUp).Row
' Loop through each cell in the column starting from the second row
For Each cell In ws.Range(ws.Cells(2, colIndex), ws.Cells(lastRow, colIndex))
' Check if the cell value does not start with "L" or "N"
If Not (Left(cell.Value, 1) = "L" Or Left(cell.Value, 1) = "N") Then
' Clear the cell contents
cell.ClearContents
' Shift cell contents up
ws.Range(cell, cell).Delete Shift:=xlShiftUp
End If
Next cell
End Sub