ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB: How do I find next blank row then add another blank row (https://www.excelbanter.com/excel-programming/334850-vbulletin-how-do-i-find-next-blank-row-then-add-another-blank-row.html)

TB

VB: How do I find next blank row then add another blank row
 
I have a fairly large spreadsheet wherein there are multiple rows of related
data separated by single blank rows. I need VB code that will find each of
the blank rows and then add another blank row adjacent to it so that I will
have a total of 2 blank rows between each set of related data. Any
suggestions would be greatly appreciated!

sebastienm

VB: How do I find next blank row then add another blank row
 
Hi,
Assuming by blank you mean empty (does not contains empty string "").
Can such blank rows be located by only looking if the cell is blank in a
particular column? If so, say it is column A. then for A1:A100:
Dim rg As Range
Set rg = Range("A1:A100").SpecialCells(xlCellTypeBlanks)
rg.EntireRow.Insert shift:=xlDown

--
Regards,
Sébastien


"TB" wrote:

I have a fairly large spreadsheet wherein there are multiple rows of related
data separated by single blank rows. I need VB code that will find each of
the blank rows and then add another blank row adjacent to it so that I will
have a total of 2 blank rows between each set of related data. Any
suggestions would be greatly appreciated!



All times are GMT +1. The time now is 03:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com