+ Reply to Thread
Results 1 to 3 of 3

Thread: Macro Help: Table Conversion

  1. #1
    Registered User
    Join Date
    12-16-2010
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2003
    Posts
    1

    Macro Help: Table Conversion

    Looking for some help trying to create a macro that could complete the following example (Each row is a row in Excel, and each large spacing is a column):

    Going from...
    IDxxxxx Region 1xxxxx Region 2xxxxx Region 3xxxxx Channel 1xxxxx Channel 2
    1xxxxxxxx XxxxxxxxxxxxxxxxxxxxxxxxxxxxXxXxxxxxxxxxxxxXxxxxxxxxxxxxx X

    To this...
    IDxxxxx Regionxxxxx Channel
    1xxxxxx Region 1xxxxxChannel 1
    1xxxxxx Region 1xxxxxChannel 2
    1xxxxxx Region 3xxxxxChannel 1
    1xxxxxx Region 3xxxxxChannel 2

    Any assistance would be greatly appreciated.

    Thanks,
    Last edited by JohnTait31490; 12-16-2010 at 05:25 PM.

  2. #2
    Forum Guru mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2007/2010
    Posts
    3,004

    Re: Macro Help: Table Conversion

    The following macro will drop the results into coulmns H to J.

    Sub Test()
    For N = 2 To Cells(Rows.Count, 1).End(xlUp).Row
        For R = 2 To 4
            If Cells(N, R) = "X" Then
                For C = 5 To 6
                    If Cells(N, C) = "X" Then
                        Cells(Rows.Count, 8).End(xlUp).Offset(1, 0) = Cells(N, 1)
                        Cells(Rows.Count, 8).End(xlUp).Offset(0, 1) = Cells(1, R)
                        Cells(Rows.Count, 8).End(xlUp).Offset(0, 2) = Cells(1, C)
                    End If
                Next C
            End If
        Next R
    Next N
    End Sub
    Martin

    Eighty Twenty Spreadsheet Automation http://homepage.ntlworld.com/martin.rice1/ for all your Excel customisation and consulting needs.

    If my solution has saved you time and/or money, please consider donating to Cancer Research UK.

  3. #3
    Forum Guru mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2007/2010
    Posts
    3,004

    Re: Macro Help: Table Conversion

    Example attached.
    Attached Files Attached Files
    Martin

    Eighty Twenty Spreadsheet Automation http://homepage.ntlworld.com/martin.rice1/ for all your Excel customisation and consulting needs.

    If my solution has saved you time and/or money, please consider donating to Cancer Research UK.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0