Blank Rows

BakerBaker

New Member
Joined
Feb 12, 2018
Messages
38
Office Version
  1. 2019
Platform
  1. Windows
Would very much appreciate assistance with the following.
I have a long list of data most of which is separated into blocks of 6 with a blank row in between. Occasionally, I encounter a block of 5 and I would like to insert a row after item 5.

1 Blue
2 Green
3 Orange
4 Red
5 Brown
6 Black
(blank row)
1 Blue
2 Green
3 Orange
4 Red
5 Brown
6 Black
(blank row)
1 Blue
2 Green
3 Orange
4 Red
5 Brown
(blank row) Want to enter an additional blank row after Item 5
1 Blue
2 Green
3 Orange
4 Red
5 Brown
6 Black
(blank row)
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Where does this data exist on your sheet?
Are they actually numbered, like you showed above?
 
Upvote 0
Try this:-
Ref Column "A"
Code:
[COLOR="Navy"]Sub[/COLOR] MG20Mar58
[COLOR="Navy"]Dim[/COLOR] Dn [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Range("A:A").SpecialCells(xlCellTypeConstants).Areas
    [COLOR="Navy"]If[/COLOR] Dn.Count = 5 [COLOR="Navy"]Then[/COLOR]
        Dn(Dn.Count + 1).EntireRow.Insert
    [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Last edited:
Upvote 0
If the numbers are in col A starting at A1 try
Code:
Sub BakerBaker()
   With Range("A2", Range("A" & Rows.Count).End(xlUp))
      .Replace 1, "=xxx", xlWhole, , , , False, False
      .SpecialCells(xlFormulas, xlErrors).EntireRow.Insert
      .Replace "=xxx", 1, xlWhole, , , , False, False
   End With
End Sub

Misread OP
This will not do what you are after. :(
 
Last edited:
Upvote 0
A bit Crude, but the first thing that came to mind...


Excel 2010
AB
11 BlueTest
22 GreenFALSE
33 OrangeFALSE
44 RedFALSE
55 BrownFALSE
66 BlackFALSE
71 BlueFALSE
82 GreenFALSE
93 OrangeFALSE
104 RedFALSE
115 BrownFALSE
126 BlackFALSE
131 BlueFALSE
142 GreenFALSE
153 OrangeFALSE
164 RedFALSE
175 BrownTRUE
181 BlueFALSE
192 GreenFALSE
203 OrangeFALSE
214 RedFALSE
225 BrownFALSE
236 Black

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
B2=(AND(LEFT(A2,1)+0=5,LEFT(A3,1)+0<>6))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,214,926
Messages
6,122,306
Members
449,079
Latest member
juggernaut24

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