How to Insert Multiple Rows or Columns in Excel with Macro - Very Easy

The functions that the Excel sheet has range from addition, subtraction, multiplication, division, averaging, percentages and even making a graph by easily taking data from multiple sheets, from there we see the usefulness of this tool.

Obviously this spreadsheet has some grids, which are divided into cells where you can enter numbers, letters, insert charts in Excel using the repeat function. To facilitate these operations, many cases are very extensive, but using Excel makes the work easier.

On a few occasions we have faced how to do different operations in an Excel spreadsheet, but when we learn the basics of Excel from then on it will be easy to handle this spreadsheet like an expert.




We can all use Excel, for example teachers or professors can teach their students to manage different mathematical calculations or a shop that wants to know the management of the inventory of products, based on cost, profit, sold in a month etc.

As we can see, Excel can work with large volumes of data, sorts them, classifies them, represents them graphically and even with little data, hence its acceptance as a tool.

Today we will learn how to insert rows or columns in Excel with a macro for facilitate management, as well as save time, do the job faster and more efficiently. Other functions are explained in those articles.

Insert rows and columns in Excel

How to Insert Multiple Rows or Columns in Excel with Macro - Very Easy

The way to insert lines, even columns in Excel is easy, we will explain it to you, there are several ways to do it, one is this method, we will explain it to you step by step:

Step 1

We select the lower cell where we want to insert;  so let's go at the beginning where it says cell, then insert, finally insert the sheet rows, ready we did it.




Step 2

The other option is in the column where you want to add; After pressing the right mouse button, a window appears in which this insert is pressed, there you can select the columns or rows you want to insert.

3 pass

We can also make it more direct; By pressing the ctrl keys at the same time the key with the plus symbol first positions itself at the point where you want to insert the column or row.

4 pass

Also, if you want to enter more than one row or column, select the amount you want to enter, and then perform one of the procedures described above.

How to insert rows and columns with macro?

How to Insert Multiple Rows or Columns in Excel with Macro - Very Easy

The first thing is to select the cell we will start at to insert;  Remember that the insertion will be made above the selected cell based on the amount chosen.

After inserting the rows, there indicate the number of rows you want to place, write the number. In the Input Box application you will be prompted for the number of rows or columns to insert under the argument type.

The coding to do this macro is the following:


Sub InsertRows ()

    Dim num Rows As Long


    'Ask the user for the number of lines to insert

    numRows = Application.InputBox (Prompt: = "Lines to insert:", Type: = 1)

      'Validate if the indicated number of lines is greater than zero


    If numRows> 0 Then

        'Insert row

    Righe (ActiveCell.Row & «:» & ActiveCell.Row + numRows – 1).Inserisci

    End if

End below

The use of  Excel it's very simple, practical, so these tips will help us handle it better and we already know how to insert rows and columns in Excel using macro.

You may be interested in knowing how to add gradients to cells using the Gradient property in an Excel macro.

TagsEccellere
add a comment of How to Insert Multiple Rows or Columns in Excel with Macro - Very Easy
Comment sent successfully! We will review it in the next few hours.