convert columns to rows
Hope this is useful..
Option Explicit
'assuming your table may have text or number
Sub transposee()
Dim lrow As Integer, i As Integer, t As Integer, z As Long
Dim sHead As String, sVal As String
Columns("W:W").ClearContents
lrow = Cells(Rows.Count, "A").End(xlUp).Row
z = 2
For i = 2 To 16 ' Here assumed that column A is not having data
sHead = Cells(1, i)
For t = 2 To lrow
sVal = Cells(t, i)
Cells(z, 23).Value = sHead & sVal ' values will appear in col W
z = z + 1
Next
Next
End Sub
column abc def ghi jkl mno int tint mint On the column need the header to
row 222 175 316 427 834 397 268 538 295 178 737 281 842 105 300
row 333 468 798 471 394 528 330 388 228 531 489 111 709 772 597
row 444 909 344 503 629 952 492 658 648 496 129 899 525 587 235
row 555 237 446 537 862 657 606 132 545 704 643 107 148 356 873
row 1236 567 558 682 118 517 855 737 734 521 590 815 161 523 593
row 345 282 497 467 121 690 986 627 803 721 117 567 205 646 579
got converted into
abc222
abc333
abc444
abc555
abc1236
abc345
def175
def468
def909
def237
def567
def282
ghi316
ghi798
ghi344
ghi446
ghi558
ghi497
jkl427
jkl471
jkl503
jkl537
jkl682
jkl467
mno834
mno394
mno629
mno862
mno118
mno121
int397
int528
int952
int657
int517
int690
tint268
tint330
tint492
tint606
tint855
tint986
mint538
mint388
mint658
mint132
mint737
mint627
On295
On228
On648
On545
On734
On803
the178
the531
the496
the704
the521
the721
column737
column489
column129
column643
column590
column117
need281
need111
need899
need107
need815
need567
the842
the709
the525
the148
the161
the205
header105
header772
header587
header356
header523
header646
to300
to597
to235
to873
to593
to579
On Saturday, 8 February 2014 23:41:16 UTC+5:30, Ty wrote:
I have a problem with data in a MS Excel spreadsheet in a column. I need 15 columns converted to rows. On the column I need the header to repeat for every item within that column.
problem:
column abc
row 222
row 333
row 444
row 555
row 1236
row 2bca
solution needed:
col-1/col-2 as headers rows all down below
abc 222
abc 333
abc 444
abc 555
abc 1236
abc 2bca
Any help will be greatly appreciated,
Ty
|