Insert alternate blank rows filled a certain colour from A3:G6211

Ironman

Well-known Member
Joined
Jan 31, 2004
Messages
1,069
Office Version
  1. 365
Platform
  1. Windows
Hi

I have a sheet containing data from A2 to G6210.

I need to insert a blank, shaded row between every row up to and including Col G (all of which contain data, which must not be amended).

Specifically, I would be very grateful for a module that I can run that will insert blank rows every other row, starting A3:A6211 inclusive, with the cells filled #EEE7D7 up to and including Col G.

i.e.

A3:G3 filled #EEE7D7

A5:G5 filled #EEE7D7

A7:G7 filled #EEE7D7

etc. etc.

A6211:G6211 filled #EEE7D7

Many thanks!
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
So do you want to insert a shaded blank row or a shaded row that has '#EEE7D7' in each cell for columns A through G?
 
Upvote 0
Hi Johnny - a shaded blank row would be great please (the RGB shade I need is 229 222 207). And I've just discovered that the hex is actually #E5DECF.
 
Upvote 0
Is the following similar to what you are seeking?

Book1
ABCDEFGH
1Header
22
3
43
5
64
7
85
9
106
11
127
13
148
15
169
17
1810
19
Sheet6
 
Upvote 0
Yes, that's exactly it thanks Johnny.
 
Upvote 0
Ok, It's probably not the most eloquent way to do it, but this is my first attempt ...

VBA Code:
Sub InsertBlankShadedRows()
'
    Dim i               As Long
    Dim LastRowInSheet  As Long
'
    LastRowInSheet = Cells.Find("*", , xlFormulas, , xlByRows, xlPrevious).Row
'
    Range("A2:A" & LastRowInSheet).Select
'
    For i = 1 To Range("A2:A" & LastRowInSheet).EntireRow.Count
        ActiveCell.Offset(1, 0).EntireRow.Insert
        ActiveCell.Resize(1, 7).Offset(1, 0).Interior.Color = RGB(229, 222, 207)
        ActiveCell.Offset(2, 0).Select
    Next
End Sub
 
Upvote 0
Many thanks Johnny - it's working and currently running row by row, it's taking quite a while (about 25% of the way through since I ran it, as soon as you posted).
 
Upvote 0
Took about 1 minute to run on my computer for 6210 original rows of data.
 
Upvote 0
Do you have more rows than the 6210 that you originally mentioned?
 
Upvote 0
Wow! It's just finished - and it's perfect, thanks ever so much Johnny! (As I have a fast processor I can only think it's because there's a fair bit of data in the filled rows?)

No, there aren't any additional rows beyond 6210.
 
Upvote 0

Forum statistics

Threads
1,215,581
Messages
6,125,657
Members
449,247
Latest member
wingedshoes

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