How To Insert Rows Using VBA In Excel || Excel Tutorials || VBA tricks

preview_player
Показать описание
In this tutorial, let us learn how to insert rows using VBA in Excel.
First let me show you how to insert a single row using the vba code.

Best Laptops to use for better speed:

Go to the vba editor window, type the code as

Sub vba_add_row()
Range("A1").EntireRow.Insert
End Sub
Now, if you run this macro, it will add a row before the cell that we mention in the code.

Go to excel and run the macro to see a new row getting inserted in the first row.

Similarly, if you want to insert multiple rows, mention the range in the vba code like this.
Sub vba_add_row()
Range("A1:A3").EntireRow.Insert
End Sub
Run this macro to see that 3 new rows getting added on top.

Now, let us see the main useful vba code to enable the user to add the desired number of rows at required location.
I am going to the vba editor window and typing the code like this.

Sub vba_add_row()
Dim iRow As Long
Dim iCount As Long
Dim i As Long

iCount = InputBox(Prompt:="How many rows you want to insert?")
iRow = InputBox _
(Prompt:="Before which row you want to insert rows? (Enter the row number)")
For i = 1 To iCount
Rows(iRow).EntireRow.Insert
Next i
End Sub

Let us run the code now, it will ask you to enter the number of rows that you want to add, say 4 and click on ok.

Our Recommendations
***************************************************************

If you found this video valuable, give it a like. If you know someone who needs to see it, share it. Leave a comment below with your thoughts. Add it to a playlist if you want to watch it later.

***********************************************

⚡️Tools for YouTube vlogging:
***********************************************
***********************************************

⚡️You Can Connect with Me at:
***********************************************

#dptutorials #Exceltraining #ExcelTricks #ExcelTips #ExcelFreeTraining #ExcelFreeLearning

⚡️Tags: -
excel formulas in English, excel in English, excel tutorial in English,ms excel in english,ms excel tutorial in English, learn excel in English,vlookup in excel in English, learn ms excel in English, excel training, excel tutorial, Microsoft Excel 2007, learn excel,tutorial excel, ms excel tutorial, excel tutorials,ms excel 2007,Microsoft Excel training,learn excel online,learning excel,free excel training,online excel training,advanced excel tutorial,excel tutorial, excel formulas and functions, excel formulas, excel tutorial in Hindi, excel formulas and functions in Hindi, excel tricks, excel in Hindi, excel shortcut keys, excel vlookup, excel formulas in Hindi, excel for beginners, excel for accounting, excel formulas and functions tutorial, Excel Sum Formula, Sum Formula series, excel attendance sheet, excel salary sheet, excel stock maintain, excel data entry, advanced excel tutorial,excel formulas,excel tutorial,vlookup excel,excel accounting,excel for beginners

⚡️Note: This description contains affiliate links, which means at no additional cost to you, we will receive a small commission if you make a purchase using the links. This helps support the channel and allows us to continue to make videos like this. Thank you for your support!
Рекомендации по теме
Комментарии
Автор

TYVM deserves more views, this will be very useful.

trlavalley
Автор

First thank you for your help and great videos, I want to know how i use macro to insert one row after each filled row for example

ahmedzeko
Автор

I love this video. Is there a way to make the number of inserted row based on a specific cell value? Like if cell A1 contains 1, it will add one row after A20, if cell A1 contains 2 it will add 2 rows after A20.

edriancocamaspardillo
Автор

What if i want the inserted rows to be in the same format of the table?

ReemaAlnogaidan
Автор

If I want the cells to inert below the active cell, how do I do this?

LiamsShortFilms
Автор

If you want to add row based on cells of value of c with then what is solution.

Like
A. B
XYZ 3
PQR 5
ABC 5
DEF 18
QRS 9

Now insert row based on cell value . Hope you understood this

palakjain