Macro help needed

rdsjms69

New Member
Joined
Nov 15, 2005
Messages
2
My spreadsheet looks like this (column A):

Apple
Apple
Apple
Apple
Orange
Orange
Orange
Pear
Pear
Pear
Banana
Banana
Banana

I need to be able to insert a blank row whenever the value in column A changes, but I cannot figure out how to do it. I am a complete rookie when it comes to Excel macros and I don't know a thing about VBA.

Please help!
 

Some videos you may like

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

jindon

MrExcel MVP
Joined
Aug 21, 2004
Messages
16,995
Hi
try
Code:
Sub test()
Dim i As Long
i = 1
Do While Cells(i, 1) <> ""
    If Cells(i + 1, 1) <> "" And Cells(i, 1) <> Cells(i + 1, 1) Then
        Rows(i + 1).Insert
        i = i + 1
    End If
    i = i + 1
Loop
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,118,114
Messages
5,570,269
Members
412,315
Latest member
ikokidko
Top