Moving Column Into Rows
Closed
John
-
Nov 1, 2010 at 09:49 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Nov 2, 2010 at 11:25 PM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Nov 2, 2010 at 11:25 PM
Related:
- Moving Column Into Rows
- Mouse cursor not moving - Guide
- How to insert picture in word without moving text - Guide
- How to delete column in word - Guide
- How to make a moving wallpaper - Guide
- Tweetdeck expand column - Guide
1 response
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Nov 2, 2010 at 11:25 PM
Nov 2, 2010 at 11:25 PM
try this macro
the main data is in sheet 1
the result is in sheet 2
the macro is
the main data is in sheet 1
the result is in sheet 2
the macro is
Sub TEST()
Dim r As Range, c As Range, j As Long, k As Long
Dim dest As Range, x(1 To 3) As String, m As Long
Worksheets("sheet2").Cells.Clear
Worksheets("sheet1").Activate
j = Range("A1").End(xlToRight).Column
Set r = Range(Range("A2"), Range("A2").End(xlDown))
For Each c In r
For k = 1 To j - 1
x(1) = Cells(c.Row, 1).Value
x(2) = Cells(1, k + 1).Value
x(3) = Cells(c.Row, k + 1).Value
'MsgBox x(1) & "," & x(2) & "," & x(3)
If Cells(c.Row, k + 1) = "" Then GoTo line1
Set dest = Worksheets("sheet2").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
Set dest = Range(dest, dest.Offset(0, 2))
dest = x
line1:
Next k
Next c
End Sub