Hello,
I am looking to write a macro that deletes certain rows on a sheet. I have just written a macro that inserts a row between entries for formatting purposes.
However on some occasions there are two accounts listed with the same Account number. When this happens i want to keep the two accounts but delete the blank line in the middle which was just inserted for formatting. Heres the code that inserts the formatting line;
'Insert Blank rows with colour between each line
Selection.End(xlDown).Select
Do Until ActiveCell.Row = 2
ActiveCell.EntireRow.Insert Shift:=xlDown
ActiveCell.RowHeight = 4.5
ActiveCell.Columns("A:N").Select
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
'Move up one row.
ActiveCell.Offset(-1, 0).Select
Loop
So basically i need something that says if Line 1 - columnA = Line 3 - columnA then Delete row in between??
So in other words, there is a blank (coloured) line between each row, i just want this removed if the account numbers are the same, but not removed if their not the same?
Thanks in advance
Eoin Walsh
I am looking to write a macro that deletes certain rows on a sheet. I have just written a macro that inserts a row between entries for formatting purposes.
However on some occasions there are two accounts listed with the same Account number. When this happens i want to keep the two accounts but delete the blank line in the middle which was just inserted for formatting. Heres the code that inserts the formatting line;
'Insert Blank rows with colour between each line
Selection.End(xlDown).Select
Do Until ActiveCell.Row = 2
ActiveCell.EntireRow.Insert Shift:=xlDown
ActiveCell.RowHeight = 4.5
ActiveCell.Columns("A:N").Select
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
'Move up one row.
ActiveCell.Offset(-1, 0).Select
Loop
So basically i need something that says if Line 1 - columnA = Line 3 - columnA then Delete row in between??
So in other words, there is a blank (coloured) line between each row, i just want this removed if the account numbers are the same, but not removed if their not the same?
Thanks in advance
Eoin Walsh