How to Insert the Row after Every 5th Row through Excel VBA?
Tags: toinserttherowaftere, vbamacros
Published: 2021-09-15 02:18:07

---
title: How to Insert the Row after Every 5th Row through Excel VBA?
published: true
date: 2021-09-14 11:27:00 UTC
tags: ToInsertTheRowAfterE,VBAMacros
canonical_url: https://geekexcel.com/how-to-insert-the-row-after-every-5th-row-through-excel-vba/
---

In this tutorial, we will guide you on  **how to insert the row after every 5th row through Excel VBA**. Let’s get them below!! Get an official version of MS Excel from the following link: **[https://www.microsoft.com/en-in/microsoft-365/excel](https://www.microsoft.com/en-in/microsoft-365/excel)**

## Example

- Firstly, you need to **create a sample data** in range **A1:F31** , in which column A contains Name, column B contains Street address, column C City, column D contains region, column E contains country name, and column F contains phone number.

![](https://geekexcel.com/wp-content/uploads/2021/09/Sample-data-9-1024x442.png)<figcaption>Sample data</figcaption>

- In the Excel Worksheet, you have to go to the  **Developer Tab.**
- Then, you need to ** ** select the  **Visual Basic**  option under the  **Code**  section.

![Select Visual Basic option](https://geekexcel.com/wp-content/uploads/2020/09/11-3.png)<figcaption>Select the Visual Basic option</figcaption>

- Now, you need to  **insert a module**.

![Insert a module](https://geekexcel.com/wp-content/uploads/2021/09/Insert-a-module.png)<figcaption>Insert a module</figcaption>

- You have to  **copy and paste**  the following code.

```
Sub InsertIT()
x = 2 'Start Row
Do
Range("A" & x, "F" & x).Insert
x = x + 5
Loop While x < 50
End Sub

```

- After that, you need to  **save the code**  by selecting it and then  **close the window**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Save-the-Code-36.png)<figcaption>Save the Code</figcaption>

- Again, you have to go to the  **Excel Spreadsheet** , and click on the  **Developer Tab**.
- You need to choose the  **Macros option**  in the Code section.

![Choose Macro option](https://geekexcel.com/wp-content/uploads/2021/09/Choose-Macro-option-11-1024x184.png)<figcaption>Choose Macro option</figcaption>

- Now, you have to make sure that your  **macro name is selected**  and click the  **Run ** button.

![](https://geekexcel.com/wp-content/uploads/2021/09/Run-the-Code-17.png)<figcaption>Run the Code</figcaption>

- Finally, **rows will get inserted** till the 50th row in the data.

![](https://geekexcel.com/wp-content/uploads/2021/09/Output-10-1024x445.png)<figcaption>Output</figcaption>

## A Short Summary

Here, we have explained the step-by-step procedure on how to **insert the row after every 5th row through Excel VBA**. Make use of this. Please share your worthwhile  **feedback**  in the below  **comment**  section. To learn more, check out our website **[Geek Excel](https://geekexcel.com/)!!**

**Read Also:**

- **[Count the Number of Words in a Cell or a Range in Excel Office 365!!](https://geekexcel.com/count-the-number-of-words-in-a-cell-or-a-range-in-excel-office-365/)**
- **[Excel Formulas Check the Cell Contains Some Words but Not Others!!](https://geekexcel.com/excel-formulas-check-the-cell-contains-some-words-but-not-others/)**
- **[Excel Formulas to Count Total Words in a Cell ~ Easy Guide!!](https://geekexcel.com/excel-formulas-to-count-total-words-in-a-cell/)**
- **[Formulas for Counting the Number of Words in a Cell or Range in Excel!!](https://geekexcel.com/formulas-for-counting-the-number-of-words-in-a-cell-or-range-in-excel/)**
- **[Excel Formulas to Count Total Words in a Range ~ Useful Tips!!](https://geekexcel.com/excel-formulas-to-count-total-words-in-a-range/)**