Delete empty row (macro)?

How to delete empty row in macro. (I think it fast than uipath)

Please guide me about it.

Hi ,

You can use read range and a filterdatatable activity to remove empty rows.

Hi @fairymemay ,

Can you share this excel file?

By the time you can use below code:

Public Function DeleteEmptyRows()
Dim xlWorkbook As Workbook
Dim xlWorksheet As Worksheet
Dim xlRange As Range
Dim lastUsedRow As Long
Dim column1 As String
Dim i As Long
i = 2
Set xlWorkbook = Workbooks.Open(“D:\UiPath Projects\Macros\Test.xlsx”, UpdateLinks:=False)
Set xlWorksheet = xlWorkbook.Worksheets(“Sheet1”)
lastUsedRow = xlWorksheet.Cells(Rows.Count, 1).End(xlUp).Row
Set xlRange = xlWorksheet.Range(“A1:A” & lastUsedRow)
For Counter = 2 To xlRange.Rows.Count
'Column Name
column1 = xlRange.Cells(i, 1).Value
If (column1 = “”) Then
i = i + 1
End If
End Function

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