Results 1 to 15 of 15

Arrange set of data from vetical to horizontal by category

Threaded View

  1. #10
    Registered User
    Join Date
    03-18-2013
    Location
    KSA
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Arrange set of data from vetical to horizontal by category

    Hello Jindon,

    It is still not plotting them by alphabetical order. And it would be better to plot the data on the same sheet cell(1,8).

    attached workbook if needed.

    Quote Originally Posted by jindon View Post
    Sub test()
        Dim a, b, i As Long, n As Long, maxRow As Long
        With Sheets("item category")
            a = .Range("a7", .Range("a" & Rows.Count).End(xlUp)).Resize(, 5).Value
        End With
        ReDim b(1 To UBound(a, 1) * UBound(a, 2), 1 To 100)
        With CreateObject("Scripting.Dictionary")
            .CompareMode = 1
            For i = 1 To UBound(a, 1)
                If Not .exists(a(i, 5)) Then
                    .Item(a(i, 5)) = Array(1, .Count + 1)
                    If UBound(b, 2) < .Count Then
                        ReDim Preserve b(1 To UBound(b, 1), 1 To UBound(b, 2) + 100)
                    End If
                    b(1, .Count) = a(i, 5)
                End If
                n = .Item(a(i, 5))(0) + 1
                b(n, .Item(a(i, 5))(1)) = a(i, 2)
                .Item(a(i, 5)) = Array(n, .Item(a(i, 5))(1))
                If maxRow < n Then maxRow = n
            Next
            ReDim Preserve b(1 To UBound(b, 1), 1 To .Count)
        End With
        With Sheets.Add.Cells(1).Resize(maxRow, UBound(b, 2))
            .Value = b
            .Columns.AutoFit
        End With
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 07-04-2018, 06:00 AM
  2. Re: Arrange horizontal data to be vertical
    By markland in forum Excel General
    Replies: 2
    Last Post: 12-16-2015, 10:49 AM
  3. Arrange horizontal data to be vertical
    By markland in forum Excel General
    Replies: 4
    Last Post: 12-15-2015, 12:04 PM
  4. Re-arrange data from vertical to horizontal
    By Haha88 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-18-2015, 02:37 AM
  5. Replies: 2
    Last Post: 06-09-2015, 09:25 PM
  6. VBA Program to arrange data at a category Level
    By navs8603 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-02-2011, 10:45 AM
  7. Transpose names from horizontal to vetical
    By zbor in forum Excel General
    Replies: 8
    Last Post: 09-21-2009, 09:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1