Insert blank row - on certain criteria

Haydo

Board Regular
Joined
Sep 5, 2011
Messages
95
on a worksheet consisting of about 20 columns.
I'd like to insert a blank row..

each time ascending numbers end down the page - (in column B)
eg.
1
2
3
4
5 I need the blank row inserted here, in between the last number & 'race'
race
tn
1
2
3
race
tn

so the end result is
1
2
3
4
5
(blank row)
race
1
2
3
(blank row)
race
tn

In column B, There are many (between 20 and 100) of these sets of ascending numbers, which end with a cell containing the word "race" and a number eg "race 3", then the next line is a cell containing 'TN', then the numbers start from 1 again, and so on.

--
If it is easier. A blank row could be inserted whenever the word 'race' is in a cell. There are 1 or 2 numbers in the same cell as 'race'. There is always a space between the word 'race' and the numbers.
There are functions used in other columns on the page

any ideas?
Thanks
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Code:
Sub Insert_Rows()
    Dim rng As Range
    Application.ScreenUpdating = False
    Range("B1", Range("B" & Rows.Count).End(xlUp)).AutoFilter Field:=1, Criteria1:="Race*"
    Set rng = Range("B2", Range("B" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeVisible)
    ActiveSheet.AutoFilterMode = False
    rng.EntireRow.Insert
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,896
Members
452,948
Latest member
Dupuhini

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