Hi,
Below is a macro that deletes all rows that are blank -
... and below is a Recorded macro that keeps First header and deletes remaining rows with headers in it -
Kindly assist in combining both the codes. Also if possible simplify the code.
Any help will be greatly appreciated.
Please find attached sheet with sample data.
Below is a macro that deletes all rows that are blank -
Code:
Sub DelEmptyRows()
Dim i As Long, iLimit As Long
iLimit = ActiveSheet.UsedRange.Rows.Count
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual 'pre XL97 xlManual
For i = iLimit To 1 Step -1
If Application.CountA(Cells(i, 1).EntireRow) = 0 Then
Cells(i, 1).EntireRow.Delete
End If
Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
iLimit = ActiveSheet.UsedRange.Rows.Count 'attempt to fix lastcell
ActiveWorkbook.Save
End Sub
... and below is a Recorded macro that keeps First header and deletes remaining rows with headers in it -
Code:
Sub Macro3()
'
' Macro3 Macro
'
'
Range("A1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$F$68").AutoFilter Field:=1, Criteria1:="Date"
ActiveCell.Offset(20, 0).Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveCell.Rows("1:37").EntireRow.Select
Selection.Delete Shift:=xlUp
ActiveCell.Offset(-20, 0).Range("A1").Select
Selection.AutoFilter
End Sub
Kindly assist in combining both the codes. Also if possible simplify the code.
Any help will be greatly appreciated.
Please find attached sheet with sample data.