Deleting empty rows

Hey guys,

I am filling 18 rows with values in dynamics empire. I need to delete the empty rows afterwards. How would i do this without making 18 if empty, click delete row activities?

Thanks in advance,

Hi @uiStijn

You can skip the empty rows using this query:

dt.AsEnumerable.Skipwhile(Function(row) row("columnName").ToString.Trim.Equals(String.Empty)).CopyToDataTable

Hope this helps,
Best Regards.


Hey Arjun,

Thank you. Sadly, I can only delete the rows after filling in the values in dynamics. Modifying the datatable beforehand would cause the values to be in the wrong place in reference to my template. :frowning:

@uiStijn ,
You need empty rows should be deleted from the above table?
If so you can use Filter data table activity.




Hi @uiStijn

I have tested this macro which deletes the row based on the unavailability of the data in the specified column. Please check this out & let us know:

Sub DeleteRowsIfColumnEmpty()
    Dim lastRow As Long
    Dim checkColumn As Integer
    Dim i As Long
    checkColumn = 1
    lastRow = Cells(Rows.Count, checkColumn).End(xlUp).Row
    For i = lastRow To 1 Step -1
        If Cells(i, checkColumn) = "" Then
        End If
    Next i
End Sub

Please note that here I’m monitoring the first column, hence checkColumn is 1.

Hope this helps,
Best Regards.

1 Like

Hey Jitesh and Arjun,

Pic#1: These are my values the dispatcher has sent to the orchestrator. As you see sometimes BAS-BAS18 contains no value, whenever that is the case i need to delete the row in the dynamics empire website(see pic#2).

Pic#2: This is my corresponding template that is being filled, column ‘kostprijs’ with all the 1,00’s is being filled but if its empty, it needs to click the 3 little dots (all the way to the left) and click remove line.