+ Reply to Thread
Results 1 to 3 of 3

pulling column_wise data into single row_wise data?!

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-28-2005
    Posts
    301

    pulling column_wise data into single row_wise data?!

    hi!

    in sheet1, i am having codes(header) (numerical/text/alpha_numerical) in col A and values(header) in col B as under:


    COL A COL B
    [codes] [values]
    abc 10
    abc -10
    1111 20
    2222 30
    1111 -40
    ab123 50
    ab123 60
    abc 20


    now what i want is in sheet2 codes in COL A and values in COL B ,
    COL C, COLD ..etc in row wise as under:


    COL A COL B COL C COL D
    [codes] [value1] [value2] [value3]
    abc 10 -10 20
    1111 20 -40
    2222 30
    ab123 50 60


    any help pl?


    thks


    -via135

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    Pasting the following code into the VBA tab for Sheet2 will regenerate the required layout every time the sheet is activated.

    Private Sub Worksheet_Activate()
    Cells.Clear
    For N = 1 To Sheets("Sheet1").Cells(65536, 1).End(xlUp).Row
        If Application.CountIf(Columns(1), Sheets("Sheet1").Cells(N, 1)) = 0 Then
            If Cells(1, 1) = "" Then
                Cells(1, 1) = Sheets("Sheet1").Cells(N, 1)
                TargetRow = 1
            Else
                Cells(65536, 1).End(xlUp).Offset(1, 0) = Sheets("Sheet1").Cells(N, 1)
                TargetRow = Cells(65536, 1).End(xlUp).Row
            End If
        Else
            TargetRow = Columns(1).Find(Sheets("Sheet1").Cells(N, 1), , xlValues, xlWhole).Row
        End If
        Cells(TargetRow, 256).End(xlToLeft).Offset(0, 1) = Sheets("Sheet1").Cells(N, 2)
    Next N
    End Sub
    Martin

  3. #3
    Forum Contributor
    Join Date
    08-28-2005
    Posts
    301

    pulling column_wise data into single row_wise data?!

    thks mr martin!
    this is what i exactly wanted!
    your code works like a charm!

    thks again!

    -via135

+ 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.6.0 RC 1