Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Excel


VBA To Insert Rows ...

I have file which is repeating, and i want to insert a row after the end of each repitition.

here is my sample data from:


new row insert
new row insert

I know it involves a macro and i dont know how. pls help as its a HUGE data and i need to automate it.

View Complete Thread with Replies

Sponsored Links:

Related Forum Messages:
VBA To Insert Rows
I need to insert 2 blank rows within a spreadsheet above certain other rows that contains data that starts with a particular text string.

Column A has office codes in the form of "0301A", "0301B", etc.
Column F will have billing codes that could start with either "L" or "ND" or "NF".

I want to separate the L's from the ND's and also the NF's in column F based on which office they are billed to.

End result:
What I want to end up with are two blank rows in between each office code in column A, then another two blank rows between the L's, ND's and NF's.

View Replies!   View Related
VBA To Insert And Delete Multiple Rows
Does anyone have codes to insert and delete multiple rows. I need to run a macro where a dialog box pops up requesting number of rows to insert and delete.

View Replies!   View Related
VBA Macro To Move & Insert Rows And Average
I would like to have a VBA code to the following:Please note that the rows are dynamic and I need the results row for every customer.Currently it is totalling and displaying the results column at the botton of every customer but I need it at the start of every customer

1.When the new customer number starts the cells are shifted and moved one row.

2.Insert the results word and it displays the results thats displayed currently at the bottom,shoudl be displayed at the top where the row gets inserted in (1)

Current view:

Customer Date of POD Del date Diff Percent

123456 03.02.2009 03.02.2009 0 100
05.02.2009 10.02.2009 5 0
Result 0

(The result is that if all the rows are 100% ,the result row is 100% else it is 0%)

Preferred View:

Customer Date of POD Del date Diff Percent

123456 Result 0
03.02.2009 03.02.2009 0 100
05.02.2009 10.02.2009 5 0

View Replies!   View Related
VBA Macro To Delete Rows/Columns, Insert Formulas & Auto Fill
I'm running a macro that opens another workbook and read data from it.How can I incorporate this code into my macro.Sorry i don't knwo VBA.

Workbooks.Open Filename:="C:Documents and SettingsmsimantbDesktopINFRACHEM_POLYMERS - DON''T DELETE.xls]Sheet1"

UserGRP_MAcro Macro
Selection.Delete Shift:=xlUp
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlUp
ActiveCell.FormulaR1C1 = "Existing userGroup"............................

View Replies!   View Related
Insert Excel Formula Using VBA......MATCH Function Is What I Want To Insert
I can use the MATCH function when i am in excel but i am having trouble getting it to work when i am trying to insert the formula using VBA.

Here is the code i have but it wont even compile........

View Replies!   View Related
Maro, Insert Rows Where Rows Determined By Number Of Carriage Returns
The best way to explain my problem is to look at the table below:

How it looks now: ApplePrice 1
Price 2
Price 3FruitDeliciousPearStore 1
Store 2FruitVery DeliciousHow I want it to look:ApplePrice 1FruitDeliciousApplePrice 2FruitDeliciousApplePrice 3FruitDeliciousPearStore 1FruitVery DeliciousPearStore 2FruitVery Delicious

View Replies!   View Related
Insert Rows Subject To Conditions In Rows Above And Below
as per the attached, need to insert those grey rows subject to the following condition :

if current row date <> next row date, .and. current row latitude / longitude <> next row latitude / longitude , insert grey row with date = current row date, else insert grey row next row date

note that the coordinates in the repeated grey rows, for the "Home" location, are the same through the sheet, should be entered by the user, at the beginning of the process, since there will be a spreasheet per user.

date is in column K
latitude / longitude are in columns B / C

this will be of tremendous assistance in automating mileage claim review.

View Replies!   View Related
Insert Vba Code With Vba
I have a code that needs to be placed on any new worksheets created. All new worksheets are made using VBA code already so they just need to be told to add the code into each new sheet. How do I do this?

View Replies!   View Related
Copy Selected Rows & Insert As Many Times As Rows Selected
The following code inserts a row below the selected row, and copies the formula of the row above into it.

Dim Rw As Integer
Rw = ActiveCell.Row
Selection.Insert Shift:=xlDown
Rows("" & Rw - 1 & ":" & Rw - 1 & "").Copy
Rows("" & Rw & ":" & Rw & "").Paste

However, I need to alter this to work for inserting more than one row at a time. ie. the user selects 'x' number of rows and 'x' rows are inserted below (in the same way 'Insert Row' works in Excel) and the row above the selection is copied down.

View Replies!   View Related
Insert All Of The Rows At Once
Is there a way to have a sort of programmed button that could be pressed that would insert all of the rows at once? Or perhaps a new line could be generated for each table with the only missing data being the values that would have to input manually?

To make it more clear I have attached a sample table. In the sample table, what I would want to do is insert a row at row 47 and at row 93. I want to do these at the same time easily. Keeping in mind that there are 40 some other tables arranged in series like that in one single spreadsheet. I cannot simply hit ctrl and select the two rows and then insert both rows, this would be equally as time consuming to do for all of the rows that would have to be added. Also, in the attached table, most of the values are either calculated values or are hard set numbers. The manually inputted values occur in columns B, E, and F. Everything else is copied down from the previous line.

View Replies!   View Related
Insert The Rows
I had fix my rows is from 1 to 100,and each ten rows consists as one row and I had use border to separate each ten rows.(Eg,row 1 to 10 is 1row).....So when I click a button and I choose to add 10rows after row 20,how can I do so? because when i choose to add 10rows after row 20,the existing row start from 21 will move down....But the problem is I had fix my rows to 100 only...How can I do so that the row 21 will move down and at the same time check the total of rows will not exceed 100?

View Replies!   View Related
Rows Insert?
Why is my code below doesn't work on Book2. The code is on Book1. If I'm on Book2 and run the macro, it applies the macro on Book1 and not Book2.

View Replies!   View Related
Macro To Insert Rows
I need a macro that will insert 11 rows before the word total. The word total will always be merged between col A&B but will not always be in the same row. It might be in row 5 one day and row 25 the next.

View Replies!   View Related
Insert Calculated Rows
I need to insert 2 calculated rows in a data table for each state, one is Direct +2%, and Contractor +2%. Ideally, I would like to copy down the field name above. Every record in the table has the same 2 Categories (Direct & Contractor) and 2 calculations need to be applied. There are ~ 50,000 records so copy insert is not an option. Can a macro be applied to do this ?

New YorkDirect150
New YorkContractor75

StateCategory Count
New YorkDirect 150
New YorkContractor 75
New YorkDirect +2%153
New YorkContractor +2%76.5
BostonDirect 200
BostonContractor 125
BostonDirect +2%204
BostonContractor +2%127.5

View Replies!   View Related
Insert 4 Rows For Each Weekday
I have a worksheet that has in column A.


I want to insert four new rows under each weekday.

blank row
blank row
blank row
blank row
blank row
blank row
blank row
blank row

I wish I had thought of this before I created 6000 rows consisting

Repeating over and over.

This was setup to track items ordered per day but I forgot I might have to order 4 items each day in some cases.

View Replies!   View Related
Insert X Rows Via InputBox
I wanted a macro to insert (the number of rows from Input box) below the active cell. Searching the forums, I found the following code.

Sub InsertRows()
Dim Rng
Rng = InputBox("Enter number of rows required.")
Range(ActiveCell.Offset(1 0), ActiveCell.Offset(Rng, 0)).Select
End Sub

If I enter a number it works fine, but if you click on the cancel button or the X to close the Input box, I get a Run-time error (13: Type mismatch). If you enter zero, it inserts 2 rows above the active cell.

I tried to modify another macro, I found on the site, that inserts rows and copies the row above, but always get the Message Box "You didn't specify a range!"

Sub InsertNumRows()
Dim Rng As Range

Application.DisplayAlerts = False
On Error Resume Next
Rng = InputBox("Enter number of rows required.")
On Error Goto 0
Application.DisplayAlerts = True.............................

View Replies!   View Related
Columns To Insert The 2 Rows
I have this excel file which has data in it. However, this data will come in everyday. Eg, A1 to A10 is QWE, A11 to A20 is RTY, A21 to 30 is UIO. But as I said earlier new data will come in everyday. For eg, it will become A1 to A15 is QWE, A16 to A30 is RTY and so and so forth.

I need to insert 2 rows after QWE, RTY, UIO. But as data will come in everyday, I cant standardise my columns to insert the 2 rows.

View Replies!   View Related
Insert Rows With Formula
I have a spreadsheet with data in the first few columns, then a few columns of different formulae which reference the data.

This spreadsheet is constantly getting rows inserted into it, and I'd like for the formulae to be copied into the new rows automatically, rather than having to copy/paste the formulae every time columns are inserted.

View Replies!   View Related
Allow My Users To Insert Rows
I need to allow my users to insert rows, however I have Data valadation lists that would be affected by the insert.

Is there a way that I can lock the spreadsheet so that they have to highlight the cells and then insert the row but NOT allow them to highlight the entire row then insert?

View Replies!   View Related
Insert Multiple Rows
Need code to insert multiple rows. I would like to be able to click a command button and have the number i have entered in a textbox be the number of rows inserted in the spreadsheet above a static cell like A12.

View Replies!   View Related
Macro To Insert Rows ..

My sheet needs to insert a blank row under a number everytime it changes.
The column "C" may have 20 or so rows with the number 10 for example, the
next five might be the number 8, I need a row between the last number ten and
the first number eight. This may be repeated many times through the

As well, the adjacent columns "D" & "E" are the same as described above.
all 3 columns are continuous ie: ....

View Replies!   View Related
Insert Rows - Macro
I have recorded a macro to insert six rows. I'd like to take this one step further and have the user enter the number of rows they want to insert. Right now the data is entered in A10:F33.

View Replies!   View Related
Insert Blank Rows?
I have a range of numbers in a single column and I want to insert a blank cell or line below each cell in the range. Is there a quick way to do this, by not using VBA.

View Replies!   View Related
Insert / Delete Rows
I'd like to create a variable list. If a number is entered into B7 (see attachement), I would like that number of rows being inserted below. Starting at A8. But I would like the list to be variable. So if a lower number is entered, the rows would be deleted. And I would be great if the formulas could be maintained.

View Replies!   View Related
Insert Rows When Data Changes
I need code that can work down a column and insert a blank row when it notices the data value has changed. i attached a file to show what i am looing for.

View Replies!   View Related
Macro To Insert Rows..
I have a worksheet that includes the list of buildings in an area and the number of households in each building. I want to list the households on separate rows and to number them from 1 to x according to the total number I have. Is it possible to do this using a macro, if so, how?

View Replies!   View Related
Formula - To Insert Rows
to be able to insert a number of rows via formula. I am having issues coming up with anything on my own. I am hoping to duplicate(and insert) a specific row (x) number of times based on a number returned from a previous formula.

View Replies!   View Related
Insert Rows By Macro
I've created a macro to assign to a button that inserts a row above say row 10, then another macro to assign to a different button that inserts a row above row 20. My problem is, having clicked the first button a row is inserted above row 10 but of course row 20 now becomes row 21, so now I need the second button to insert a row above row 21 instead of 20.

Is there any way I can write a macro that remembers the old row numbers?

View Replies!   View Related
Insert Rows With Data
i have a list of numbers in column A and in column B every now and then a * will appear next to a number. The first number will always have a * next to it. Basically i'm looking for a way to say...that either by copying to another tab or inserting rows on this tab, do the following for every number.

Insert a row above that says


put a " next to the number so that it reads as below


and then the following in new rows as below.

[tab field]
[tab field]
[tab field]
[tab field]

View Replies!   View Related
Insert Rows Between Different Values In A
I need a code that will insert 3 rows between different values found in column A. I tried using this but it inserts rows between every value found.

View Replies!   View Related
Insert Rows By Criteria
i need a macro for inserting a row in sheet by criteria. the Criteria:

1-checking if Collumn G ( letters ) are equal
if not then inserting the row
2-cheking if collumn H ( numbers ) are equal
if not then inserting the row

one more thing i need the row to be yellow from collumn B .. to .. I

View Replies!   View Related
Inputbox For Insert Rows
Sub AddRows()
Dim r As Long
For r = Cells(Rows.Count, 6).End(xlUp).Row To 2 Step -1
If Cells(r, 6) <> Cells(r - 1, 6) Then Rows(r).Insert Shift:=xlDown
Next r
End Sub

but find it somewhat unflexible. I don't always use the same column reference to determine where to add the rows. I was hoping someone would be able to integrate the inputbox usage that is in this delete rows code I got here

'Get the relative column number where the criteria should be found
lCol = Application.InputBox(Prompt:="Type in the relative number of the column where " _
& "the criteria can be found.", Title:="CONDITIONAL ROW DELETION COLUMN NUMBER", Type:=1)

I am wanting to run an insert row macro and it prompt me asking what column I want to reference. Whenever there is a change in that column, insert a row.

View Replies!   View Related
Insert Rows At Change In Cells
I have a large file that has the following setup
2003 Zipper X
2004 Zipper X
2005 Zipper X
2003 Zipper Z
2004 Zipper Z
2005 Zipper Z
How can I insert rows at changes in the product description

View Replies!   View Related
Checkbox To Delete Or Insert Rows
I have a worksheet that has been created to essentially request information needed to determine a demo system configuration. Within this worksheet there are a series of checkboxes that if checked, will need to have the form extended (i.e. add additional questions to clarify say a model or manufacturer). For example, if the Yes checkbox is checked next to a question I want a macro to copy some rows from a hidden worksheet within the same workbook to the bottom of the non-hidden worksheet. If the No checkbox is clicked, nothing should happen. Furthermore, if a user accidently click Yes but didn't mean to I want the added rows to be removed. This is further complicated by the fact that there are 2 or 3 questions that have check boxes that can add additional questions.

View Replies!   View Related
Insert Empty Rows Code
Can VBA code that inserts between written rows a certain number of empty rows (and to be able to specify somewhere in the code the number of rows to be inserted)

View Replies!   View Related
Insert Rows At A Change In A Column
I'm not really all that familiar with a lot of things in Excel. I do know how to make a macro, which this question is to help with, but I kinda skipped a lot of learning in between.

I am wanting a shortcut that will insert a new row after each change in column A. I don't think Subtotals is the answer because after I enter the row to seperate them I will want to enter another row and seperate again by column F when there is a change that is not a blank row.

View Replies!   View Related
Insert Rows Based On The Value On Column F
I want to insert rows based on the coloumn F (has 6.00 on it)


Since the coloumn F has value 6 on it, i want to insert 5 rows below the current row

View Replies!   View Related
Insert Rows At Specifice Location
I need a macro that will look in column B of a worksheet for the value "Grp2" and begin inserting rows underneath that value based on a variable that I will pass to it. The variable will be how many rows to insert.
For example if value "Grp2" occurs in cell B19,beginning at cell B20 I want to insert a specified number of rows.

******** ******************** ************************************************************************>Microsoft Excel - Test2.xls___Running: 11.0 : OS = Windows XP (F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)boutJ19=
[HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name box

View Replies!   View Related
Prevent Insert New Rows Or Columns
What is the easiest way to stop users inserting new columns or rows into a workbook? Is it a case of protecting each sheet individually?

View Replies!   View Related
Insert Multiple Rows And Label Accordingly
in inserting 8 rows as per the attached spreadsheet highlighted in orange, and labelling them, obviously, the year after the one above it.

View Replies!   View Related
Insert Rows At The Active Cell
I want to be able to allow a user to insert a number of rows (they would specify the number) into a worksheet, at the active cell location. I also need the same number of rows to be inserted into the same worksheet (but much lower down) The location of which is to be governed by the location of the original inserted rows.

Having created the new rows I need all the formulas from the row ABOVE the active cell to be copied into all the newly created rows.

If active cell is A5 I want user to be able to run a macro which asks them how many rows they wish to insert. (Assume the user asks for 7).

The macro then inserts that number of rows, (starting at row 5). And additionally adds 7 rows at a location further down the worksheet (say row 105). The formulas from the row above the active cell are then copied into all the newly created rows.

2nd example
If the active cell was A9 then the macro would add 7 rows, starting at row 9 and additionally add 7 rows starting at row 109. Then formulas added.

View Replies!   View Related
Insert Two Columns For Selected Rows
I would like to select a number of columns and then run a macro that would insert two columns after each of the selected columns.

Or is there perhaps a faster way than using a macro?

View Replies!   View Related
Insert Rows With Missing Dates
I have a sequence(or a series is more proper) of dates(without the hours) for. exapmple: 10/22/2007,1025/2007,10/25/2007. What I need is to insert rows with the missing dates. I found a VBE code for a macro which does the work but now the problem is that in some rows the dates are the same and if I have two times 10/25/2007 it adds the row with the next date after the first one and all messes up.

Do Until ActiveCell.Value = Empty
If ActiveCell.Value = ActiveCell.Offset(-1, 0).Value + 1 Then
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = ActiveCell.Offset(-1, 0).Value + 1
ActiveCell.Offset(1, 0).Select
End If

View Replies!   View Related
Macro To Insert Rows Part II
i needed a macro that would go through the cells in column A, which is a list of adverstiser and insert a row when the name of the advertiser changed. So the macro needs to compare each cell to the one before and when the values differ, insert a macro. But I need one that will first go through column A, and then once finished with the items in A, go through column B and do the same thing. Can't get the column B to work...

View Replies!   View Related
Macro To Insert Rows At Different Points
Column 'A' in my spreadsheet has cells with a number in and blank cells in no particular order. What I need to do is insert a new row above each number but I don't know how to write this as a macro.

View Replies!   View Related
Macro To Insert Formatted Rows
I need columns A, B, and C to have borders all the way around each cell in the row. Then, columns D through H need to be merged, with one border around the merged cell. The row height needs to be size 16 font, which I've been solving by putting in one letter that size, colored white so it doesn't show up when I print.

Basically, I have a spreadsheet of a bunch of tools, and I need to insert a row below each entry for the mechanics to sign their initials for three stages of the repair process, and also have the larger, merged cell for notes.

View Replies!   View Related
Insert Rows Every Nth Row ...
I know this has been asked a million and 1 times, but I can't seem to find any history of it.

Does anyone know how to add a row in a spreadsheet every say 5th row OR add a row whenever a specific string or value is found?

View Replies!   View Related
Macro To Insert Rows Using A Worksheet Value
Need to look at a number in a cell, inserts that many rows below that row, then repeats this for following rows that also have cells that indicate how many rows to insert.

Attached is a simple sample data sheet with how data looks before and how it should look after.

View Replies!   View Related
Insert Rows On Multiple Sheets
way to automatically insert rows and copy data on multiple selected sheets. for example, if i insert a row anywhere on sheet 3, i need that same row inserted in the same location with the cells populated with the same data on sheets 4, 6 and 9.

View Replies!   View Related
Insert Rows Based On A Value In A Cell
I need to create a macro that will insert exact number of rows based on the value in certain cell. e.g. value in cell F2 of sheet1 is I need to insert 3 rows down from cell F9 in sheet2 copying data in cells D9 and E9 to inserted Cells / rows.

View Replies!   View Related
Copyright 2005-08, All rights reserved