Hello guys,
I have a macro to delete empty rows. Unfortunately it leaves rows with cells that contain formulas like "=IF(ISBLANK(SHEET1!N18),"",SHEET2!N18)"
Here is what I have:
Private Sub Delete_Only_Empty1()
' Variable decration.
Dim LastRow As Long
Dim R As Long
' Disable screen flickering.
Application.ScreenUpdating = False
' Find the last row with data in the Range. and assign it to the variable LastRow.
LastRow = ActiveSheet.UsedRange.Row - 1 + ActiveSheet.UsedRange.Rows.Count
For R = LastRow To 1 Step -1
If Application.WorksheetFunction.CountA(Rows(R)) = 0 Then Rows(R).Delete
Next R
' Enable back the screen.
Application.ScreenUpdating = True
End Sub
I have tried to add another condition within the If Statement: ... AND ActiveCell.HasFormula = True but it did not work.
Any suggestions how to modify the procudere?
Thank you very much.
Bookmarks