Insert Blank Row Below Highlighted Cell in Bulk VBA

datamoto

New Member
Joined
Nov 12, 2021
Messages
3
Office Version
  1. 2021
Platform
  1. Windows
I have been pulling my hair out as my data requirements are ever expanding, am currently using Marco to insert Row ABOVE coloured cells in bulk (Macro Below) which works perfectly

VBA Code:
Sub INSERTABOVE()
    LastRow = Range("C" & Rows.Count).End(xlUp).Row
    Dim i As Long
    For i = LastRow To 1 Step -1
        If Range("C" & i).Interior.Color = 65535 Then
            Rows(i).Select
            Selection.Insert Shift:=xlDown
            With Rows(i).Interior
                .Pattern = xlNone
                .TintAndShade = 0
                .PatternTintAndShade = 0
            End With
        End If
    Next i
    
End Sub

I want to insert a Blank Row below Coloured cell, basically the opposite of above, I run them as 2 separate processes, Can someone help me please!
 
Last edited by a moderator:

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Welcome to the forum. :)

Try something like:

VBA Code:
Sub INSERTBELOW()
    LastRow = Range("C" & Rows.Count).End(xlUp).Row
    Dim i As Long
    For i = LastRow To 1 Step -1
        If Range("C" & i).Interior.Color = 65535 Then
            Rows(i + 1).Insert Shift:=xlDown
            With Rows(i + 1).Interior
                .Pattern = xlNone
                .TintAndShade = 0
                .PatternTintAndShade = 0
            End With
        End If
    Next i
    
End Sub
 
Upvote 0
Solution
Welcome to the forum. :)

Try something like:

VBA Code:
Sub INSERTBELOW()
    LastRow = Range("C" & Rows.Count).End(xlUp).Row
    Dim i As Long
    For i = LastRow To 1 Step -1
        If Range("C" & i).Interior.Color = 65535 Then
            Rows(i + 1).Insert Shift:=xlDown
            With Rows(i + 1).Interior
                .Pattern = xlNone
                .TintAndShade = 0
                .PatternTintAndShade = 0
            End With
        End If
    Next i
   
End Sub
Will give it a go, I have 7.4 million rows to process
 
Upvote 0
In a worksheet? That's impressive... ;)
 
Upvote 0

Forum statistics

Threads
1,214,967
Messages
6,122,503
Members
449,090
Latest member
RandomExceller01

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