Copy certain cells into subsequent rows

jconnats

New Member
Joined
Aug 9, 2010
Messages
2
I have a chart that has 3 columns.
Warehouse #, Item #, and Description.
When i import data into this worksheet there are certain headers in the description column that i would like copied into the rows that are under that description. Example:


Description:
Title 1
Data 1
Data 2
Data 3
Title 2
Data 1
Data 2
Data 3
Title 3
and so on...

So what i am asking for: Is there a macro to move the titles to the end of the rows which have the data in them and then delete the title rows so that only the data is left in the description column with the matching title at the end of the data rows?
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

venkat1926

Well-known Member
Joined
Aug 21, 2005
Messages
4,824
Your requirements are not very clear to me. I am rephrasing it . your have data like this in sheet1 from A1 to C4

Title 1 Title 2 Title 3
Data 1 Data 1 Data 1
Data 2 Data 2 Data 2
Data 3 Data 3 Data 3

you want in another sheet(sheet2) the data should be like this

description
Data 1
Data 2
Data 3
Data 1
Data 2
Data 3
Data 2
Data 3
Title 1
Data 1
Data 2
Data 3
Data 1
Data 2
Data 3
Data 2

If this is so try this macro

Code:
Sub test()
Dim r As Range, j As Integer, k As Integer
Dim dest As Range
Worksheets("sheet1").Activate
j = Range("A1").End(xlToRight).Column
For k = 1 To j
Set r = Range(Cells(k, "A"), Cells(k, "A").End(xlDown))
r.Copy
With Worksheets("sheet2")
Set dest = .Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
dest.PasteSpecial
End With
Next k
With Worksheets("sheet2")
.Range("A1") = "description"

End With
End Sub
 

jconnats

New Member
Joined
Aug 9, 2010
Messages
2
Sorry for being unclear.

The sheet is always changing as far as the number of rows. But, the columns are always Warehouse #, Item #, and Description.

Warehouse #...... Item #...... Description
[blank].............[blank]........Memphis
[blank]...........3423525........Item 1
[blank]............453456.........Item 2
[blank].............[blank].........New York
[blank].............4534656.........Item 1
[blank]............45323423........Item 2
and so on...
The number of items under the location are always different when things get pulled into this sheet. I just need a macro to take the location(such as memphis or new york) and move it to the warehouse column beside the items that are in that warehouse. When i pull the information into this sheet the warehouse column starts out blank. Hope this clarifies it a little more.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,838
Messages
5,833,921
Members
430,244
Latest member
Ireland1

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