# Cell Distribution

#### dhen21dx

##### Board Regular
Hello,

Just want to ask if there is an easy way to distribute the data from Column A to Column B, the result will be on Column D&E.

Last edited:

#### dhen21dx

##### Board Regular
Sorry didnt get it, can you have a simple code?

##### MrExcel MVP
Let me try again...

Your question is too vague for anyone to be able to answer. What data? What do you mean by 'distribute'? What does '...the result will be on Column D&E" mean etc etc.

A worked example would help...

#### dhen21dx

##### Board Regular
Here is the sample: Column A = Material1; B = Material2, D&E is the combination result.

 Result Material1 Material2 Material1 Material2 40000000001 50000000201 40000000001 50000000201 40000000002 50000000202 40000000002 50000000201 50000000203 40000000001 50000000202 50000000204 40000000002 50000000202 40000000001 50000000203 40000000002 50000000203 40000000001 50000000204 40000000002 50000000204

<colgroup><col><col><col><col span="2"></colgroup><tbody>
</tbody>

#### Rick Rothstein

##### MrExcel MVP
Give this macro a try...
Code:
``````[table="width: 500"]
[tr]
[td]Sub Distribute()
Dim X As Long, R As Long, Acount As Long, Bcount As Long
Acount = Range("A2", Cells(Rows.Count, "A").End(xlUp)).Rows.Count
Bcount = Range("B2", Cells(Rows.Count, "B").End(xlUp)).Rows.Count
Range("D1:E1").Value = Range("A1:B1").Value
For X = 1 To Bcount
R = Cells(Rows.Count, "D").End(xlUp).Offset(1).Row
Cells(R, "D").Resize(Acount).Value = Range("A2", Cells(Rows.Count, "A").End(xlUp)).Value
Cells(R, "E").Resize(Acount).Value = Cells(1 + X, "B").Value
Next
End Sub[/td]
[/tr]
[/table]``````

1,081,992
Messages
5,362,603
Members
400,683
Latest member
LogChief

### This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...