View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave D-C[_3_] Dave D-C[_3_] is offline
external usenet poster
 
Posts: 176
Default Transpose 3 columns into Single column

Just an OlderDude trying to learn NewTricks. Thanks again for your patience.

Well isn't this group a great place for that!

In case your columns get larger than 5, I would:
Option Explicit

Sub Sub1()
Dim iRowFmZ&, iRowFm&, iColFm&, iRowTo&
iRowFmZ = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
iRowTo = 1
For iRowFm = 2 To iRowFmZ
For iColFm = 1 To 5
Sheets("Sheet1").Cells(iRowFm, iColFm).Copy _
Sheets("Sheet2").Cells(iRowTo, 1)
iRowTo = iRowTo + 1
Next iColFm
iRowTo = iRowTo + 1 ' skip?
Next iRowFm
End Sub

AncientLearner wrote:
Thanks Dave, and no, it is not a trick question, just trying to get a handle
on a the number of columns variable. So, is it also logical the for
additional columns to be:
rngTo.Offset(3, 0).Value = rng.Offset(0, 3).Value
rngTo.Offset(4, 0).Value = rng.Offset(0, 4).Value
rngTo.Offset(5, 0).Value = rng.Offset(0, 5).Value