Insert extra lines

R

RENEE

I have a worksheet sent to me with over 700 names on it. I need to put 4
extra lines under each name. Is there a way to do this without having to
individually insert those lines as this will take a long time. Thanks.
 
B

Bob I

What is the reason/purpose for placing 4 lines under each name? More
likely you may use 4 columns after the name for that purpose.
 
D

Dave Peterson

Insert a new column A.

Put 1, 2, 3, ..., 700 in A1:A700
Put 1 in A1
put 2 in A2
Select both A1:A2 and drag down to A700.

Select A1:A700
Edit|copy
Select A701
Edit|paste

Do the same in A1401 and A2101

Now you have 2800 lines that are used.

Select all your columns and sort by column A ascending and column B descending
(putting the name at the top).

Delete column A.
 
T

Tom Hutchins

Here is a macro MVP Don Guillett wrote in reply to a similar request. It
assumes the 700 names are in column A. Column A is represented by the 1 in
Cells(Rows.Count, 1). Change it if necessary (A=1, B=2, etc.)

Sub insertrows()
'by Don Guillett
Dim i As Long
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
Rows(i).Resize(4).Insert
Next i
End Sub

Put this code in a general Visual Basic module:
1. ALT-F11 brings up the Visual Basic Editor (VBE) window
2. ALT-I then M opens a fresh module
3. Paste in the code and close the VBE window
4. The macro is available to run, and will be saved with the workbook.

Press ALT-F8 to display the list of available macros in your workbook.
If you are new to macros, these links may be helpful:
http://peltiertech.com/WordPress/2008/03/09/how-to-use-someone-elses-macro/
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Hope this helps,

Hutch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top