I have the following code to delete blank rows on sheets "Output Accounts" and "Input Accounts" as well as to insert headings in A1 & B2 on these sheets
When Running the code it is deleting all the rows on sheet "Output accounts" and not doing anything on sheet "Input accounts"
After running the Macro the sheet output accounts looks like this
See my code below
It would be appreciated if someone could assist me
When Running the code it is deleting all the rows on sheet "Output accounts" and not doing anything on sheet "Input accounts"
After running the Macro the sheet output accounts looks like this
Excel 2012 | ||||
---|---|---|---|---|
A | B | |||
1 | Amount | |||
2 | Account Number | |||
3 | ||||
4 | ||||
5 | ||||
6 | ||||
7 | ||||
Output Accounts |
See my code below
It would be appreciated if someone could assist me
Code:
Sub Remove_Blanks()
Dim Lr As Long
Lr = Cells(Rows.Count, "A").End(xlUp).Row
With Sheets("Output Accounts")
With Range("A1:B" & Lr)
.SpecialCells(xlCellTypeBlanks).Select
.EntireRow.Delete
With Range("A1")
.EntireRow.Insert , CopyOrigin:=xlFormatFromLeftOrAbove
.FormulaR1C1 = "Account Number"
With Range("B1")
.FormulaR1C1 = "Amount"
With Range("A:A")
.EntireColumn.AutoFit
End With
End With
End With
End With
End With
With Sheets("Input Accounts")
With Range("A1:B" & Lr)
.SpecialCells(xlCellTypeBlanks).Select
.EntireRow.Delete
With Range("A1")
.EntireRow.Insert , CopyOrigin:=xlFormatFromLeftOrAbove
.FormulaR1C1 = "Account Number"
With Range("B1")
.FormulaR1C1 = "Amount"
With Range("A:A")
.EntireColumn.AutoFit
End With
End With
End With
End With
End With
With Sheets("Extracted Data")
With Range("A1").Activate
End With
End With
End Sub [\code]