Insert & Copy

pp2002

New Member
Joined
May 19, 2002
Messages
10
Hi all,

Can you please help?

I have received an excell file containing 5000+ lists of buildings, on line 1, then 2 etc. These are all on one sheet. I need to insert 22 lines between each name and copy a set of info into these lines (this will be the same for each building).

Any ideas?
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

pp2002

New Member
Joined
May 19, 2002
Messages
10
Thanks for the reply,

I feel silly now; there are only 500+ buildings & not 5000!

The reason it must be on a single sheet is for the “upload” to a computer system.

Thanks again.

PP
 

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
This code is for a module, it will insert your copy range into a column list of names, when a name changes on your list. Note: The copy range to paste must be on another sheet. You must change one Offset row value for the number of rows your copy range will need. Sheet names in the code may need changing. See code for notes. JSW

Sub OnChangeInsCopy()
Dim myRows As Long
Dim myPlace

myRows = ActiveSheet.UsedRange.Rows.Count
'The column range to start checking for name changes.
Worksheets("Sheet1").Range("A2").Select
Do Until Selection.Row = myRows + 1
'Stop loop when column is blank.
If Selection.Value = "" Then
GoTo myEnd
End If
'On name break, paste.
If Selection.Value <> Selection.Offset(-1, 0).Value Then
myPlace = Selection.Address
'Range to paste on break.
'Note: Copy data must be on different sheet!
Sheets("Sheet2").Select
Range("A1:A3").Select
Selection.Copy
Sheets("Sheet1").Select
Worksheets("Sheet1").Range(myPlace).Select
Selection.Insert Shift:=xlDown
'Go to the next row.
myRows = myRows + 1
'The Offset is the # of rows of copy Data + 1.
Selection.Offset(4, 0).Select
Else
Selection.Offset(1, 0).Select
End If
'Do the whole sheet!
Loop
'Stop at end of data.
myEnd:

End Sub
 

Forum statistics

Threads
1,143,916
Messages
5,721,525
Members
422,369
Latest member
redinator

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top