Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have an easy one for you guys.... I want to use VBA to make a simple loop that will go down the page in Excel in my current file and duplicate each row, adding it into the row below it. Got any simple VBA code?? I'm too tired to come up with it on my own! THank you! Kristen -- Kristen ------------------------------------------------------------------------ Kristen's Profile: http://www.excelforum.com/member.php...o&userid=33199 View this thread: http://www.excelforum.com/showthread...hreadid=570526 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This code is sloppy and I'm sure there is some overkill in it, but it works.
The key is, before you run the code, you must click on the cell in column A at which row you would like to start this process. If you want to start at the top, just click on A1 to select the cell, and then run this code. This will find the last row which has data in column A to determine how many times the duplication process must repeat. If the last row to be duplicated does not have data in column A of that row, you'll need to modify the code slightly. Save you're work first. HTH, Paul Sub Macro1() i = Range("A65536").End(xlUp).Row s = i - ActiveCell.Row + 1 c = 1 For r = 1 To i ActiveCell.EntireRow.Select Selection.Copy Rows(Selection.Row & ":" & Selection.Row).Offset(1, 0).Select Selection.Insert Shift:=xlDown ActiveCell.Offset(1, 0).Select If c = s Then End c = c + 1 Next r End Sub "Kristen" wrote in message ... I have an easy one for you guys.... I want to use VBA to make a simple loop that will go down the page in Excel in my current file and duplicate each row, adding it into the row below it. Got any simple VBA code?? I'm too tired to come up with it on my own! THank you! Kristen -- Kristen ------------------------------------------------------------------------ Kristen's Profile: http://www.excelforum.com/member.php...o&userid=33199 View this thread: http://www.excelforum.com/showthread...hreadid=570526 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thank You!!!! : -- Kriste ----------------------------------------------------------------------- Kristen's Profile: http://www.excelforum.com/member.php...fo&userid=3319 View this thread: http://www.excelforum.com/showthread.php?threadid=57052 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copying and inserting lines | Excel Worksheet Functions | |||
Inserting Lines or Copying lines with formulas but without data | Excel Discussion (Misc queries) | |||
Quick and easy | Excel Worksheet Functions | |||
Quick and Easy! | Excel Programming | |||
Inserting Lines And Copying Them | Excel Programming |