AFlyingHippo
New Member
- Joined
- Jul 15, 2013
- Messages
- 1
Hi All,
I have a worksheet that has data in 52 rows (starting at row 2) and 4 columns (A, B, C, and D). Currently column A is unique to itself, and Columns B, C, D go together. Excluding headers, each column has the following number of cells with data:
Column A has 52 cells
Column B has 40 cells
Column C has 40 cells
Column D has 40 cells - 1 unique cell
I need a macro that will make 40 copies of all 52 cells in Column A, and pair them with the cells in column B, C, and D
Example:
<colgroup><col style="width:48pt" span="4" width="64"> </colgroup><tbody>
[TD="class: xl65, width: 64"][TABLE="width: 256"]
<colgroup><col style="width:48pt" span="4" width="64"> </colgroup><tbody>[TR]
[TD="class: xl66, width: 64"]Name
[/TD]
[TD="class: xl66, width: 64"]Country[/TD]
[TD="class: xl66, width: 64"]City[/TD]
[TD="class: xl66, width: 64"]Constant[/TD]
[TD="class: xl67"]Alex[/TD]
[TD="class: xl67"]United Kingdom[/TD]
[TD="class: xl67"]London[/TD]
[TD="class: xl67"]Yes[/TD]
[TD="class: xl67"]Brian[/TD]
[TD="class: xl67"]China[/TD]
[TD="class: xl67"]Beijing[/TD]
[TD="class: xl67"]Yes[/TD]
[TD="class: xl67"]Calvin[/TD]
[TD="class: xl67"]United States[/TD]
[TD="class: xl67"]Miami[/TD]
[TD="class: xl67"]Yes[/TD]
[TD="class: xl67"]David[/TD]
[TD="class: xl67"]United States[/TD]
[TD="class: xl67"]Chicago[/TD]
[TD="class: xl67"]Yes[/TD]
[TD="class: xl67"] [/TD]
[TD="class: xl67"]Japan[/TD]
[TD="class: xl67"]Tokyo[/TD]
[TD="class: xl67"]Yes[/TD]
[TD="class: xl67"] [/TD]
[TD="class: xl67"]United Kingdom[/TD]
[TD="class: xl67"]Leeds[/TD]
[TD="class: xl67"]Yes[/TD]
[TD="class: xl67"] [/TD]
[TD="class: xl67"]Germany[/TD]
[TD="class: xl67"]Berlin[/TD]
[TD="class: xl67"]Yes
[/TD]
[TD="class: xl67"]
[/TD]
[TD="class: xl67"]France[/TD]
[TD="class: xl67"]Paris[/TD]
[TD="class: xl67"]Yes
[/TD]
</tbody>[/TD]
[TD="class: xl65, width: 64"][/TD]
[TD="class: xl65, width: 64"][/TD]
[TD="class: xl65, width: 64"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Becomes:
[TABLE="width: 300"]
<colgroup><col><col><col span="2"></colgroup><tbody>[TR]
[TD]Name[/TD]
[TD]Country[/TD]
[TD]City[/TD]
[TD]Constant[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]United Kingdom[/TD]
[TD]London[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]China[/TD]
[TD]Beijing[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]United States[/TD]
[TD]Miami[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]United States[/TD]
[TD]Chicago[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]Japan[/TD]
[TD]Tokyo[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]United Kingdom[/TD]
[TD]Leeds[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]Germany[/TD]
[TD]Berlin[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]France[/TD]
[TD]Paris[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]United Kingdom[/TD]
[TD]London[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]China[/TD]
[TD]Beijing[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]United States[/TD]
[TD]Miami[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]United States[/TD]
[TD]Chicago[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]Japan[/TD]
[TD]Tokyo[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]United Kingdom[/TD]
[TD]Leeds[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]Germany[/TD]
[TD]Berlin[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]France[/TD]
[TD]Paris[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]United Kingdom[/TD]
[TD]London[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]China[/TD]
[TD]Beijing[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]United States[/TD]
[TD]Miami[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]United States[/TD]
[TD]Chicago[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]Japan[/TD]
[TD]Tokyo[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]United Kingdom[/TD]
[TD]Leeds[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]Germany[/TD]
[TD]Berlin[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]France[/TD]
[TD]Paris[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]United Kingdom[/TD]
[TD]London[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]China[/TD]
[TD]Beijing[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]United States[/TD]
[TD]Miami[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]United States[/TD]
[TD]Chicago[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]Japan[/TD]
[TD]Tokyo[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]United Kingdom[/TD]
[TD]Leeds[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]Germany[/TD]
[TD]Berlin[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]France[/TD]
[TD]Paris[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]United Kingdom[/TD]
[TD]London[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]China[/TD]
[TD]Beijing[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]United States[/TD]
[TD]Miami[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]United States[/TD]
[TD]Chicago[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]Japan[/TD]
[TD]Tokyo[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]United Kingdom[/TD]
[TD]Leeds[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]Germany[/TD]
[TD]Berlin[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]France[/TD]
[TD]Paris[/TD]
[TD]Yes[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Thank you for your help.
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I have a worksheet that has data in 52 rows (starting at row 2) and 4 columns (A, B, C, and D). Currently column A is unique to itself, and Columns B, C, D go together. Excluding headers, each column has the following number of cells with data:
Column A has 52 cells
Column B has 40 cells
Column C has 40 cells
Column D has 40 cells - 1 unique cell
I need a macro that will make 40 copies of all 52 cells in Column A, and pair them with the cells in column B, C, and D
Example:
<colgroup><col style="width:48pt" span="4" width="64"> </colgroup><tbody>
[TD="class: xl65, width: 64"][TABLE="width: 256"]
<colgroup><col style="width:48pt" span="4" width="64"> </colgroup><tbody>[TR]
[TD="class: xl66, width: 64"]Name
[/TD]
[TD="class: xl66, width: 64"]Country[/TD]
[TD="class: xl66, width: 64"]City[/TD]
[TD="class: xl66, width: 64"]Constant[/TD]
[TD="class: xl67"]Alex[/TD]
[TD="class: xl67"]United Kingdom[/TD]
[TD="class: xl67"]London[/TD]
[TD="class: xl67"]Yes[/TD]
[TD="class: xl67"]Brian[/TD]
[TD="class: xl67"]China[/TD]
[TD="class: xl67"]Beijing[/TD]
[TD="class: xl67"]Yes[/TD]
[TD="class: xl67"]Calvin[/TD]
[TD="class: xl67"]United States[/TD]
[TD="class: xl67"]Miami[/TD]
[TD="class: xl67"]Yes[/TD]
[TD="class: xl67"]David[/TD]
[TD="class: xl67"]United States[/TD]
[TD="class: xl67"]Chicago[/TD]
[TD="class: xl67"]Yes[/TD]
[TD="class: xl67"] [/TD]
[TD="class: xl67"]Japan[/TD]
[TD="class: xl67"]Tokyo[/TD]
[TD="class: xl67"]Yes[/TD]
[TD="class: xl67"] [/TD]
[TD="class: xl67"]United Kingdom[/TD]
[TD="class: xl67"]Leeds[/TD]
[TD="class: xl67"]Yes[/TD]
[TD="class: xl67"] [/TD]
[TD="class: xl67"]Germany[/TD]
[TD="class: xl67"]Berlin[/TD]
[TD="class: xl67"]Yes
[/TD]
[TD="class: xl67"]
[/TD]
[TD="class: xl67"]France[/TD]
[TD="class: xl67"]Paris[/TD]
[TD="class: xl67"]Yes
[/TD]
</tbody>
[TD="class: xl65, width: 64"][/TD]
[TD="class: xl65, width: 64"][/TD]
[TD="class: xl65, width: 64"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Becomes:
[TABLE="width: 300"]
<colgroup><col><col><col span="2"></colgroup><tbody>[TR]
[TD]Name[/TD]
[TD]Country[/TD]
[TD]City[/TD]
[TD]Constant[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]United Kingdom[/TD]
[TD]London[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]China[/TD]
[TD]Beijing[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]United States[/TD]
[TD]Miami[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]United States[/TD]
[TD]Chicago[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]Japan[/TD]
[TD]Tokyo[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]United Kingdom[/TD]
[TD]Leeds[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]Germany[/TD]
[TD]Berlin[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]France[/TD]
[TD]Paris[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]United Kingdom[/TD]
[TD]London[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]China[/TD]
[TD]Beijing[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]United States[/TD]
[TD]Miami[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]United States[/TD]
[TD]Chicago[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]Japan[/TD]
[TD]Tokyo[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]United Kingdom[/TD]
[TD]Leeds[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]Germany[/TD]
[TD]Berlin[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]France[/TD]
[TD]Paris[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]United Kingdom[/TD]
[TD]London[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]China[/TD]
[TD]Beijing[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]United States[/TD]
[TD]Miami[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]United States[/TD]
[TD]Chicago[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]Japan[/TD]
[TD]Tokyo[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]United Kingdom[/TD]
[TD]Leeds[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]Germany[/TD]
[TD]Berlin[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]France[/TD]
[TD]Paris[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]United Kingdom[/TD]
[TD]London[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]China[/TD]
[TD]Beijing[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]United States[/TD]
[TD]Miami[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]United States[/TD]
[TD]Chicago[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]Japan[/TD]
[TD]Tokyo[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]United Kingdom[/TD]
[TD]Leeds[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]Germany[/TD]
[TD]Berlin[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]France[/TD]
[TD]Paris[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]United Kingdom[/TD]
[TD]London[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]China[/TD]
[TD]Beijing[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]United States[/TD]
[TD]Miami[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]United States[/TD]
[TD]Chicago[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Alex[/TD]
[TD]Japan[/TD]
[TD]Tokyo[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Brian[/TD]
[TD]United Kingdom[/TD]
[TD]Leeds[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Calvin[/TD]
[TD]Germany[/TD]
[TD]Berlin[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD]France[/TD]
[TD]Paris[/TD]
[TD]Yes[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Thank you for your help.
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]