

The cell variable is incremental to the next customer reference, and the loop continues until it reaches an empty cell. The loop inserts new multiple rows and then copies the row using the FillDown method. So, in this example, the looping continues until an empty cell is encountered. The loop continues until the statement at the beginning resolves to FALSE. Range(cell, cell.Offset(cell.Value – 1, 1)).EntireRow.FillDownĪ do-while loop is almost exactly the same as a do until loop-there’s just one crucial difference.

Range(cell.Offset(1, 0), cell.Offset(cell.Value – 1, _ I have created the variable of Dim cell as Range and set the cell B2 as the first cell to contain a number. This simply creates a memory container for the values. Now, all that is needed is the rest of the code that will insert our blank rows in between these two lines of code.įirst, I need to declare some variables in this macro. To use this method, all you need to do is select the number of rows you want to add, right-click on the selection, and select Insert.As you type the name of the Macro and hit return, Excel will automatically insert End Sub. Next, add an ActiveX Button control anywhere on the sheet (assuming sheet1). How to Insert Multiple Rows Using the Insert Option Add two columns (or more) and few rows data to your Excel worksheet.
