Rows to col

gnusmas

Board Regular
Joined
Mar 5, 2014
Messages
186
Hi friends i have Groups of ROWS values separate I want each group From rows TO col
WITHOUT duplicates AND SORT Accending
Exemple Sheet1
122428313739
112227454648
232532414246
031922252945
070817183348

<colgroup><col span="6"></colgroup><tbody>
</tbody>

010206233844
051825324045
022027313749
283436434648
071117192636

<colgroup><col span="6"></colgroup><tbody>
</tbody>

283134374246
061220384449
111527303139
051922233538
072435364347

<colgroup><col span="6"></colgroup><tbody>
</tbody>
Sheet2
A B C D E F etc....
030105
070206
080507
110611
120712
171115
181719
191820
221922
232023
242324
252527
272628
282730
292831
313134
323235
333436
373637
393738
413839
424042
454343
464444
484546
4647
4849
49

<colgroup><col span="3"></colgroup><tbody>
</tbody>
Thank you for help
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Code:
Sub r_to_col_iz_cool()
    Dim iCounter As Integer: iCounter = 1
    Dim cool As Integer: cool = 0
    Dim m_1 As Worksheet, m_2 As Worksheet
    Set m_1 = ActiveWorkbook.Sheets("Sheet1")
    Set m_2 = ActiveWorkbook.Sheets("Sheet2")
    Dim m_addy As String
    Dim iMax As Integer
    Dim iRows As Integer
    m_1.Select
    While Not m_1.Range("A" & iCounter).Value = vbNullString
        iRows = m_1.Range("A" & iCounter).CurrentRegion.Rows.Count
        m_addy = m_1.Range("A" & iCounter).CurrentRegion.Address
        iMax = Evaluate("MAX(" & m_addy & ")")
        With m_2.Range("A1").Offset(, cool).Resize(iMax)
            .Formula = _
                "=IFERROR(SMALL('" & m_1.Name & "'!" & m_addy & ", ROWS(A$1:A1)),"""")"
            .Value = .Value
            .RemoveDuplicates 1, xlNo
        End With
        iCounter = iCounter + 2 + iRows
        cool = cool + 1
    Wend
    m_2.Select
End Sub
 
Upvote 0
Code:
Sub dmdf()

Dim a, b() As Boolean, c, e(), u&

For Each a In Range("A:F").SpecialCells(xlConstants).Areas
ReDim b(50), e(1 To 50, 1 To 1)
d = 0: u = u + 1

For Each c In a
    b(c) = True
Next c

For c = 1 To 50
    If b(c) Then d = d + 1: e(d, 1) = c
Next c

Sheets("sheet2").Cells(u).Resize(d) = e
Next a

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,692
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top