My requirement is to delete empty/blank rows from excel except headers , i used insert/delete rows , but it takes more time to delete if 1000’s of records , so i tried an alternate of invoke vba with clear contents , but that adds blanks spaces , so i need delete blank rows in excel with vba any solutions
I am trying to use the below code but getting some errors macros disable when it is actually enabled , but idk how to use this code and pass inputs in invoke vba
Rows("2:" & Rows.Count).ClearContents
@Palaniyappan @Yoichi @supermanPunch
Thanks in advance
You could read the excel into a datatable and use LinQ to filter then rewrite the datatable?
Use Invoke Code:
DataTable.AsEnumerable().Where(Function(row) row.ItemArray.All(Function(field) field Is Nothing Or field Is DBNull.Value Or field.Equals(“”))).ToList().ForEach(Sub(row) row.Delete())
Datatable - In/Out
Dt.ASenumerable.where(Function(r) Dt.Columns.Cast(of DataColumn).All(Function(c) Not String.isNullorEmpty(r(c).Tostring.Trim))).Copytodatatable
@Gangadhar_Athili should be used in assign activity?
Yes - Assign it to datatable variable
I got this
Assign: The source contains no DataRows.
Make sure you replace DT with the variable name of your datatable.