![]() |
|
|||||||
|
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Based on your original post and attached file.
You only need to use column B data as your source range. Code:
Sub TransposeBom()
Dim lr As Long, rng As Range, cel As Range
Dim ChildNum As Integer
Dim destSheet As Worksheet, writeRow As Long
With Sheets("Source or Input")
lr = .Range("B" & Rows.Count).End(xlUp).Row
Set rng = .Range("B2:B" & lr)
End With
Set destSheet = Sheets("Desired Output")
writeRow = 5 'to keep away from posted desired results
For Each cel In rng
If cel.Value <> cel.Offset(-1).Value Then
ChildNum = 1
Else
ChildNum = ChildNum + 1
End If
With destSheet
If ChildNum = 1 Then
writeRow = writeRow + 1
.Cells(writeRow, 1).Resize(, 3).Value = cel.Resize(, 3).Value
.Cells(writeRow, 4).Resize(, 5).Value = cel.Offset(, 3).Resize(, 5).Value
Else
.Cells(writeRow, 4).Offset(, (ChildNum - 1) * 5).Resize(, 5).Value = cel.Offset(, 3).Resize(, 5).Value
End If
End With
Next cel
End Sub
|
|
#2
|
|||
|
|||
|
Wow! Thanks a great help to me!!
![]() Thanks. But how to mark it as an answer
|
|
#3
|
|||
|
|||
|
From the Thread Tools drop down, on the line above your first post, you select "Mark this thread as solved" You should also go to your other posting of this question and put a link to here. |
|
| Tags |
| bill of materials, bom, transpose |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
BOM (bill of material)
|
umairn | Project | 1 | 04-17-2017 02:11 PM |
Integrating Bill Of Materials (BOM)
|
GRT45 | Project | 1 | 03-16-2017 10:26 PM |
Inserting material after Endnotes
|
ClaireB | Word | 19 | 10-01-2015 07:54 PM |
Project 2013 reading material
|
Steve. | Project | 3 | 05-17-2014 07:08 AM |
Purging duplicated material in a document
|
NepalKat#1 | Word | 1 | 09-03-2011 05:53 AM |