Excel conditional format - Shift Cells Down

I have attached a picture for what I am trying to accomplish.

Effectively, I would like to insert and shift down the cells filled with the color black(pictured).

First, columns D & E, then Next columns A, B & C... then repeat
columns D & E then columns A, B & C
columns D & E then columns A, B & C
columns D & E then columns A, B & C


Excel-Shift-Black-Columns-Down-D-E-then-
LVL 9
K BAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saurabh Singh TeotiaCommented:
Can you give a sample file to play around with ..as it will be easy to manipulate that..

Also in the same file just show how does the current output is and how do you want to show..?

Saurabh...
K BAuthor Commented:
Saurabh,

Thank you.  Have attached the "current state" and what I would like as a "future state" in two different tabs in the attached file.

Many thanks!

K.B.sample4EE.xlsx
Saurabh Singh TeotiaCommented:
Quick question would the headers row will always be in black color??
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

K BAuthor Commented:
Sure that would be no problem.  Yes that is how it is now.
Saurabh Singh TeotiaCommented:
Never Mind..You can run this code and it will do what you are looking for...

Sub rearrangedata()

    Dim i As Long
    i = 1

    Do Until i > Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

        If Cells(i, "a").Value <> "" Then
            Range("A" & i + 1 & ":C" & i + 1).Insert Shift:=xlDown
            Range("A" & i + 1 & ":C" & i + 1).Clear
            Range("D" & i & ":E" & i).Insert Shift:=xlDown
            i = i + 1
        Else
            i = i + 1
        End If
    Loop

End Sub

Open in new window


Saurabh...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
K BAuthor Commented:
You are amazing!!!
K BAuthor Commented:
Yet again, you rock!
Saurabh Singh TeotiaCommented:
Glad to help.. :-)

Saurabh...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.