View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban[_2_] Alan Beban[_2_] is offline
external usenet poster
 
Posts: 783
Default Multi Line Transpose Excel VBA code

wrote:
I have data that is listed in one long vertical column:

ADAM1
ADAM2
ADAM3
ADAM4
ADAM5
BOAT1
BOAT2
BOAT3
BOAT4
BOAT5

the listings of the "ADAM" and "BOAT" is always 5.
I'm showing two (ADAM and BOAT) in this example, but in my reality
there are thousands.`

I need some code to move this data into horizontal cells like this:

ADAM1 ADAM2 ADAM3 ADAM4 ADAM5
BOAT1 BOAT2 BOAT3 BOAT4 BOAT5

Can someone get me started...

If the functions in the freelydownloadable file at
http://home.pacbell.net/beban are available to your workbook

Set rng = range("a1:a50")
a = rng
b = ArrayReshape(a, rng.Rows.Count / 5, 5)
range("b1:f" & rng.Rows.Count / 5).Value = b

Alan Beban