View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
bobbe bobbe is offline
external usenet poster
 
Posts: 2
Default how do you interleave two columns

Thanks. Instead of 250 how do you get the number of cells in column A or B?
Some kind of length function?

"Gord Dibben" wrote:

Sub columnmerge()

For i = 1 To 250
ActiveSheet.Cells(i, 3) = ActiveSheet.Cells _
((i + 1 - ((i + 1) Mod 2)) / 2, ((i + 1) Mod 2) + 1)
Next i

End Sub


Gord Dibben MS Excel MVP

On Tue, 12 Jun 2007 11:37:01 -0700, bobbe
wrote:

If you have two columns of data, what's the easiest way to automatically
(programatically?) interleave them. The resulting column should consist of:

1st cell of 1st column
1st cell of 2nd column
2nd cell of 1st column
2nd cell of 2nd column
etc.

For example,
1 a
2 b
3 c

would become:

1
a
2
b
3
c