Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Inserting Rows Through a Macro
I'm trying to create a macro in Excel 2002 where, I can
insert two rows between every number in column A: Column A 1 2 3 4 5 6 7 8 9 Any ideas? Thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Inserting Rows Through a Macro
Mike,
Try Sub insertrows() Application.ScreenUpdating = False Application.Calculation = xlCalculationManual LR = Range("A" & Rows.Count).End(xlUp).Row For i = LR To 2 Step -1 Range("A" & i & ":A" & (i + 1)).EntireRow.Insert Next i Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic End Sub Cecil "Mike" wrote in message ... I'm trying to create a macro in Excel 2002 where, I can insert two rows between every number in column A: Column A 1 2 3 4 5 6 7 8 9 Any ideas? Thanks in advance. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Inserting Rows Through a Macro
Cecil,
Thanks so much! That worked like a champ. Wondering if you can help me with the second piece, where I'm trying to paste formulas into the blank rows i've just inserted. Again, this would be repeated down the entire spreadsheet. I've named a range of cells w/formulas that I'd like to copy "formularange". Thanks again. -----Original Message----- Mike, Try Sub insertrows() Application.ScreenUpdating = False Application.Calculation = xlCalculationManual LR = Range("A" & Rows.Count).End(xlUp).Row For i = LR To 2 Step -1 Range("A" & i & ":A" & (i + 1)).EntireRow.Insert Next i Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic End Sub Cecil "Mike" wrote in message ... I'm trying to create a macro in Excel 2002 where, I can insert two rows between every number in column A: Column A 1 2 3 4 5 6 7 8 9 Any ideas? Thanks in advance. . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Inserting Rows Through a Macro
Mike,
you can try it by adding this line just before Next i Range("A" & i & ":A" & (i + 1)).Formula = _ Range("formularange").Formula or this line Range("formularange").Copy _ Destination:=Range("B" & i) But I think you need a different approach. Cecil "Mike" wrote in message ... Cecil, Thanks so much! That worked like a champ. Wondering if you can help me with the second piece, where I'm trying to paste formulas into the blank rows i've just inserted. Again, this would be repeated down the entire spreadsheet. I've named a range of cells w/formulas that I'd like to copy "formularange". Thanks again. -----Original Message----- Mike, Try Sub insertrows() Application.ScreenUpdating = False Application.Calculation = xlCalculationManual LR = Range("A" & Rows.Count).End(xlUp).Row For i = LR To 2 Step -1 Range("A" & i & ":A" & (i + 1)).EntireRow.Insert Next i Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic End Sub Cecil "Mike" wrote in message ... I'm trying to create a macro in Excel 2002 where, I can insert two rows between every number in column A: Column A 1 2 3 4 5 6 7 8 9 Any ideas? Thanks in advance. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro auto inserting rows and formulas | Excel Discussion (Misc queries) | |||
Macro Help- Inserting Blank Rows | Excel Discussion (Misc queries) | |||
Macro needed for inserting blank rows | Excel Worksheet Functions | |||
Inserting Blank Rows Macro? | Excel Worksheet Functions | |||
INSERTING ROWS WITH A MACRO | Excel Programming |