robivagasi
New Member
- Joined
- Jan 27, 2021
- Messages
- 1
- Office Version
- 2016
- Platform
- Windows
Hi!
I wrote a Macro what can delete the empty rows, but in the mepty cells there is an IF function.
So when the IF function write nothing i want to delete it automatically with macro.
Sub DeleteAllEmptyRows()
Dim LastRowIndex As Integer
Dim RowIndex As Integer
Dim UsedRng As Range
Set UsedRng = ActiveSheet.UsedRange
LastRowIndex = UsedRng.Row - 1 + UsedRng.Rows.Count
Application.ScreenUpdating = False
For RowIndex = LastRowIndex To 1 Step -1
If Application.CountA(Rows(RowIndex)) = 0 Then
Rows(RowIndex).Delete
End If
Next RowIndex
Application.ScreenUpdating = True
End Sub
It is possible or not?
Thank you!!
I wrote a Macro what can delete the empty rows, but in the mepty cells there is an IF function.
So when the IF function write nothing i want to delete it automatically with macro.
Sub DeleteAllEmptyRows()
Dim LastRowIndex As Integer
Dim RowIndex As Integer
Dim UsedRng As Range
Set UsedRng = ActiveSheet.UsedRange
LastRowIndex = UsedRng.Row - 1 + UsedRng.Rows.Count
Application.ScreenUpdating = False
For RowIndex = LastRowIndex To 1 Step -1
If Application.CountA(Rows(RowIndex)) = 0 Then
Rows(RowIndex).Delete
End If
Next RowIndex
Application.ScreenUpdating = True
End Sub
It is possible or not?
Thank you!!