Inserting 6 blank rows automatically between groups of data

bran987

New Member
Joined
Jan 10, 2005
Messages
45
Hello everyone

I'm wondering how to automatically insert blank rows based on this:

I have company names, about 50. There is about 2,000 lines of data after it's all sorted

So it will be like:

----------------

Microsoft
Microsoft
Microsoft
Apple
Apple
Apple
Apple
Yahoo
Yahoo
Yahoo
Yahoo

----------------

If the company names are say... in Row Q, how would I automatically insert 6 blank rows at the point where the company names changes?

Thanks so much guys.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi there,

Try

Code:
Sub test()

Dim i as Long

For i = Range("Q65334").End(xlUp).Row To 2 Step -1
   If Cells(i, "Q").Value <> Cells(i - 1, "Q").Value Then
     Rows(i & ":" & i + 6).Insert
   End If
Next i


End Sub
 
Upvote 0
That is incredible! How did you do that so fast? Thank you! I only wish I knew where to begin learning things like that.
 
Upvote 0
Cheers :)

I've learned all i know of this msg board. There are some real gurus on here, to pick up things from.
 
Upvote 0

Forum statistics

Threads
1,214,431
Messages
6,119,462
Members
448,899
Latest member
maplemeadows

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top