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?
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

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.
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,733
Messages
5,513,077
Members
408,937
Latest member
NAGARAJAN_EXCEL

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top