How to add a few blank cells between text filled cells

GratefullyDyed

New Member
Joined
Nov 26, 2016
Messages
27
Office Version
  1. 2021
Platform
  1. Windows
Hello,
I am trying to add 7 blank cells between each data filled cell to properly fit in another spreadsheet for uploading to shopify. Here is what I need in photos:

1663371025299.png


I need to do that to fit into this:

1663371098537.png


Please let me know the best way to accomplish this that you know of. Thank you!
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
You say that you're trying to:
add 7 blank cells between each data filled cell
however, your image shows 6 blank cells between each data filled cell? Anyhow, the following code will insert 6 blank cells between each data filled cell - change Resize(6) to Resize(7) if 7 was your intention. This works on column B of the active sheet, change to suit.

VBA Code:
Option Explicit
Sub InsertRows2()
    Dim LRow As Long, i As Long
    LRow = Cells(Rows.Count, "B").End(xlUp).Row
    For i = LRow To 1 Step -1
        Cells(i, 2).Offset(1).Resize(6).Insert xlShiftDown
    Next i
End Sub
 
Upvote 0
Solution
You say that you're trying to:

however, your image shows 6 blank cells between each data filled cell? Anyhow, the following code will insert 6 blank cells between each data filled cell - change Resize(6) to Resize(7) if 7 was your intention. This works on column B of the active sheet, change to suit.

VBA Code:
Option Explicit
Sub InsertRows2()
    Dim LRow As Long, i As Long
    LRow = Cells(Rows.Count, "B").End(xlUp).Row
    For i = LRow To 1 Step -1
        Cells(i, 2).Offset(1).Resize(6).Insert xlShiftDown
    Next i
End Sub
I will give that a go thanks!!
 
Upvote 0
You say that you're trying to:

however, your image shows 6 blank cells between each data filled cell? Anyhow, the following code will insert 6 blank cells between each data filled cell - change Resize(6) to Resize(7) if 7 was your intention. This works on column B of the active sheet, change to suit.

VBA Code:
Option Explicit
Sub InsertRows2()
    Dim LRow As Long, i As Long
    LRow = Cells(Rows.Count, "B").End(xlUp).Row
    For i = LRow To 1 Step -1
        Cells(i, 2).Offset(1).Resize(6).Insert xlShiftDown
    Next i
End Sub
That worked amazing thank you!
I have one more thing I am trying to figure out if you would be so kind to extend help once more. It is very similar so I am trying to figure out if I could change up a little of this code and get it to work for this job. Alas, it is a bit above my expertise lol

1663383574609.png

In this column I need to separate my 4 product images by 3 blank cells before the next product images. Currently they are just piled on top of eachother in a different sheet in column B:

1663383691945.png


Thanks again for your help that worked great for me!
 
Upvote 0
I was able to make it work by just freezing the top row. Thanks again for your help providing that code! I dont fully understand it but with some tinkering this is what I have now that works:

1663384636808.png
 
Upvote 0
Very close :) We need to accommodate a number of entries that isn't divisible by 4 to avoid that. Try this:

VBA Code:
Option Explicit
Sub InsertCells()
    Dim LRow As Long, i As Long
    LRow = Cells(Rows.Count, "B").End(xlUp).Row
    i = LRow Mod 4
    LRow = LRow - i
   
    For i = LRow To 1 Step -4
        Cells(i, 1).Offset(1).Resize(3).EntireRow.Insert
    Next i
End Sub
 
Upvote 0
Very close :) We need to accommodate a number of entries that isn't divisible by 4 to avoid that. Try this:

VBA Code:
Option Explicit
Sub InsertCells()
    Dim LRow As Long, i As Long
    LRow = Cells(Rows.Count, "B").End(xlUp).Row
    i = LRow Mod 4
    LRow = LRow - i
  
    For i = LRow To 1 Step -4
        Cells(i, 1).Offset(1).Resize(3).EntireRow.Insert
    Next i
End Sub
Yes this new does seem to work but I am dumb and should have been starting with a frozen row1 anyway, as I will want a title row in my spreadsheet. I am trying now to change your recent code to start at row 2 instead of row one. All I am doing is changing numbers tho lol. I dont know much about this kind of thing. Would I need to add something to it to tell it to start on row 2?
 
Upvote 0
As of now I just changed the offset to 2 and that seems to work but idk if thats right.

1663387432008.png
 
Upvote 0

Forum statistics

Threads
1,214,999
Messages
6,122,645
Members
449,093
Latest member
Ahmad123098

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