Hi All...I am certainly not a master VBA'r, and I cannot find a way to solve the following problem.
I start with a 2 column data set of varying lengths. Column A has Product codes and Column B has Product information. One of the codes is "PN" in column A, this "PN" indicates the start of a new Part Number. The rows following this "PN" have information relating to that Part Number. The number of rows vary depending on the part. Then when the row after the first "PN" has code "PN" this begins a new part number and information so on and so on until there is a blank row. There could be 3 parts or 1,000 parts and the length of the initial 2 column dataset could be 10 rows or 10,000
[TABLE="class: outer_border, width: 100, align: center"]
<tbody>[TR]
[TD="align: center"]Column A[/TD]
[TD="align: center"]Column B[/TD]
[/TR]
[TR]
[TD]PN[/TD]
[TD]12345[/TD]
[/TR]
[TR]
[TD]PD[/TD]
[TD]Desk[/TD]
[/TR]
[TR]
[TD]SP[/TD]
[TD]100.00[/TD]
[/TR]
[TR]
[TD]BP[/TD]
[TD]75.00[/TD]
[/TR]
[TR]
[TD]QT[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]OB[/TD]
[TD]87[/TD]
[/TR]
[TR]
[TD]WT[/TD]
[TD]75[/TD]
[/TR]
[TR]
[TD]PN[/TD]
[TD]98765[/TD]
[/TR]
[TR]
[TD]PD[/TD]
[TD]Shelf[/TD]
[/TR]
[TR]
[TD]BP[/TD]
[TD]35.00[/TD]
[/TR]
[TR]
[TD]MC[/TD]
[TD]R101[/TD]
[/TR]
[TR]
[TD]PN[/TD]
[TD]99999[/TD]
[/TR]
[TR]
[TD]PD[/TD]
[TD]Part[/TD]
[/TR]
[TR]
[TD]QT[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]
Now the problem is that I need to copy each part number and the following required part information for that part number (Just the data from Column B) onto rows in Sheet 2. Sheet 2 is laid out with each required code on the columns as headers for the data. (If Column A on the vertical dataset has a code that is not shown as headers on Sheet 2, the data is not needed and not copied to Sheet 2)So the data for the codes must be copied into the correct column header in Sheet 2. Every Part will have a PN (Part Number) and a PD (Part Description)
[TABLE="class: grid, width: 100, align: center"]
<tbody>[TR]
[TD="align: center"]PN[/TD]
[TD="align: center"]PD[/TD]
[TD="align: center"]SP[/TD]
[TD="align: center"]QT[/TD]
[TD="align: center"]SP[/TD]
[TD="align: center"]BP[/TD]
[TD="align: center"]MG[/TD]
[TD="align: center"]OL[/TD]
[TD="align: center"]MC[/TD]
[TD="align: center"]DT[/TD]
[/TR]
[TR]
[TD]12345[/TD]
[TD]Desk[/TD]
[TD]100.00[/TD]
[TD]2[/TD]
[TD][/TD]
[TD]70.00[/TD]
[TD][/TD]
[TD]Oak[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]98765[/TD]
[TD]Shelf[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]35.00[/TD]
[TD][/TD]
[TD][/TD]
[TD]R101[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]99999[/TD]
[TD]Part[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[/TR]
</tbody>[/TABLE]
I need to have each part number laid out horizontally so that I can import the data for all the parts into QuickBooks.
I have exhausted my limited VBA knowledge after trying to solve this for weeks. I am hoping this is a simple problem and I am just not seeing it. Thanks for your help
I start with a 2 column data set of varying lengths. Column A has Product codes and Column B has Product information. One of the codes is "PN" in column A, this "PN" indicates the start of a new Part Number. The rows following this "PN" have information relating to that Part Number. The number of rows vary depending on the part. Then when the row after the first "PN" has code "PN" this begins a new part number and information so on and so on until there is a blank row. There could be 3 parts or 1,000 parts and the length of the initial 2 column dataset could be 10 rows or 10,000
[TABLE="class: outer_border, width: 100, align: center"]
<tbody>[TR]
[TD="align: center"]Column A[/TD]
[TD="align: center"]Column B[/TD]
[/TR]
[TR]
[TD]PN[/TD]
[TD]12345[/TD]
[/TR]
[TR]
[TD]PD[/TD]
[TD]Desk[/TD]
[/TR]
[TR]
[TD]SP[/TD]
[TD]100.00[/TD]
[/TR]
[TR]
[TD]BP[/TD]
[TD]75.00[/TD]
[/TR]
[TR]
[TD]QT[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]OB[/TD]
[TD]87[/TD]
[/TR]
[TR]
[TD]WT[/TD]
[TD]75[/TD]
[/TR]
[TR]
[TD]PN[/TD]
[TD]98765[/TD]
[/TR]
[TR]
[TD]PD[/TD]
[TD]Shelf[/TD]
[/TR]
[TR]
[TD]BP[/TD]
[TD]35.00[/TD]
[/TR]
[TR]
[TD]MC[/TD]
[TD]R101[/TD]
[/TR]
[TR]
[TD]PN[/TD]
[TD]99999[/TD]
[/TR]
[TR]
[TD]PD[/TD]
[TD]Part[/TD]
[/TR]
[TR]
[TD]QT[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]
Now the problem is that I need to copy each part number and the following required part information for that part number (Just the data from Column B) onto rows in Sheet 2. Sheet 2 is laid out with each required code on the columns as headers for the data. (If Column A on the vertical dataset has a code that is not shown as headers on Sheet 2, the data is not needed and not copied to Sheet 2)So the data for the codes must be copied into the correct column header in Sheet 2. Every Part will have a PN (Part Number) and a PD (Part Description)
<tbody>[TR]
[TD="align: center"]PN[/TD]
[TD="align: center"]PD[/TD]
[TD="align: center"]SP[/TD]
[TD="align: center"]QT[/TD]
[TD="align: center"]SP[/TD]
[TD="align: center"]BP[/TD]
[TD="align: center"]MG[/TD]
[TD="align: center"]OL[/TD]
[TD="align: center"]MC[/TD]
[TD="align: center"]DT[/TD]
[/TR]
[TR]
[TD]12345[/TD]
[TD]Desk[/TD]
[TD]100.00[/TD]
[TD]2[/TD]
[TD][/TD]
[TD]70.00[/TD]
[TD][/TD]
[TD]Oak[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]98765[/TD]
[TD]Shelf[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]35.00[/TD]
[TD][/TD]
[TD][/TD]
[TD]R101[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]99999[/TD]
[TD]Part[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[TD]ETC.[/TD]
[/TR]
</tbody>[/TABLE]
I need to have each part number laid out horizontally so that I can import the data for all the parts into QuickBooks.
I have exhausted my limited VBA knowledge after trying to solve this for weeks. I am hoping this is a simple problem and I am just not seeing it. Thanks for your help