Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Quick and Easy: Copying and Inserting Lines Using VBA


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default Quick and Easy: Copying and Inserting Lines Using VBA

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Quick and Easy: Copying and Inserting Lines Using VBA


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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying and inserting lines teo410 Excel Worksheet Functions 6 August 13th 09 05:31 PM
Inserting Lines or Copying lines with formulas but without data wnfisba Excel Discussion (Misc queries) 2 August 18th 06 04:41 PM
Quick and easy chisigs2 Excel Worksheet Functions 2 August 24th 05 08:36 PM
Quick and Easy! DBAL[_6_] Excel Programming 3 May 13th 05 08:52 AM
Inserting Lines And Copying Them Troyk Excel Programming 1 May 27th 04 03:19 PM


All times are GMT +1. The time now is 08:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"