![]() Now, the specific number of blank rows are inserted into the existing data at the regular interval you specified, see screenshot: In the following prompt box, please enter the number of blank rows that you want to insert.Another prompt box will pop out, please enter the number of row interval.In the prompt box, select the data range where you want to insert blank rows. After pasting this code, please press F5 key to run this code.Step 2: Execute the code to get the result XWs.Range(xWs.Cells(xNum1, WorkRng.Column), xWs.Cells(xNum1 + xRows - 1, WorkRng.Column)).Select XRows = Application.InputBox("How many rows to insert at each interval? ", xTitleId, 1, Type:=1) XInterval = Application.InputBox("Enter row interval. Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8) VBA code: Insert specific number of blank rows into data at fixed intervals Sub InsertRowsAtIntervals() ![]() Click Insert > Module, and paste the following code in the Module Window.Hold down the ALT + F11 keys in Excel, and it opens the Microsoft Visual Basic for Applications window.Step 1:Open the VBA module editor and copy the code If you are interested in VBA code, here, we will provide a code for inserting specific number of blank rows into your data at fixed intervals. Insert blank row every other or nth row with VBA code Now, a single blank row will be inserted into the data after every two rows, see screenshot: (Here, I will insert one blank row after two rows, so, I enter 2 and 1 into the Interval of and Rows boxes separately.) Then, specify the numbers into the Interval of and Rows textboxes as you need.Choose Blank Rows from the Insert type section. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |