Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to insert columns with macro
I've got a spreadsheet that I need to modify. One of the fields says "number
of photos" and I want to take that number, and insert the number of rows I want right beneath, then continue to the next item in the field and do the same thing. In the other columns, I want to copy the data that's there to the new row(s). I can't find a command to automatically insert a row, though. Thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to insert columns with macro
This will insert the rows for you.
Sub InsertRows() Dim LastRow As Long Dim i As Long Application.ScreenUpdating = False LastRow = Range("A65536").End(xlUp).Row For i = LastRow To 1 Step -1 If IsNumeric(Range("A" & i)) Then Range("A" & i).Offset(1, 0).Resize(Range("A" & i)).EntireRow.Insert End If Next 'i Application.ScreenUpdating = True End Sub Regards Trevor "THE GAME" wrote in message ... I've got a spreadsheet that I need to modify. One of the fields says "number of photos" and I want to take that number, and insert the number of rows I want right beneath, then continue to the next item in the field and do the same thing. In the other columns, I want to copy the data that's there to the new row(s). I can't find a command to automatically insert a row, though. Thanks in advance. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to insert columns with macro
Numrows = 10
ActiveCell.Resize(numRows,1).EntireRow.Insert -- Regards, Tom Ogilvy "THE GAME" wrote in message ... I've got a spreadsheet that I need to modify. One of the fields says "number of photos" and I want to take that number, and insert the number of rows I want right beneath, then continue to the next item in the field and do the same thing. In the other columns, I want to copy the data that's there to the new row(s). I can't find a command to automatically insert a row, though. Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to insert and move columns | Excel Discussion (Misc queries) | |||
can no longer insert new columns & unhide hidden columns | Excel Worksheet Functions | |||
unable to insert columns in excel, insert- columns (disabled) | Excel Discussion (Misc queries) | |||
insert columns macro is putting 2 columns instead of 1 | Excel Worksheet Functions | |||
Macro to insert page breaks when values in 1 or more columns changes | Excel Programming |