+ Reply to Thread
Results 1 to 4 of 4

help moving data

Hybrid View

sjgidman1982 help moving data 07-24-2016, 04:43 PM
protonLeah Re: help moving data 07-24-2016, 05:10 PM
sjgidman1982 Re: help moving data 07-24-2016, 05:13 PM
protonLeah Re: help moving data 07-30-2016, 12:38 AM
  1. #1
    Registered User
    Join Date
    02-20-2009
    Location
    Stoke-on-Trent, England
    MS-Off Ver
    Excel 2013
    Posts
    12

    help moving data

    in the image below there is a table i have downloaded, the information is spread accross multiple rows and i want it all to be on the same row as i have done for the first entry then i need to delete the duplicate name values in the first column

    any ideas?

    thanks in advance

    Untitled.png

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,952

    Re: help moving data

    (How to) Upload a Workbook directly to the Forum
    (please do not post pictures or links to worksheets)
    • Click Advanced next to Quick Post button at the bottom right of the editor box.
    • Scroll down until you see "Manage Attachments",
    • Click the "Choose" button at the upper left (upload from your computer).
    • Select your file, click "open", click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Close the Attachment Manager window.
    • Click "Submit Reply"
    Note: Please do not attach password protected workbooks/worksheets
    Ensure to disable any Workbook Open/Autorun macros before attaching!
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    02-20-2009
    Location
    Stoke-on-Trent, England
    MS-Off Ver
    Excel 2013
    Posts
    12

    Re: help moving data

    workbook attached
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,952

    Re: help moving data

    Option Explicit
    Sub MergeRows()
        Dim LastRec     As Long, _
            TitleCount  As Long, _
            CurrentRec  As Long, _
            Ndx         As Long, _
            DestRow     As Long, _
            FieldPtr       As Long, _
            TitleList   As Range, _
            TestTitle   As String
            
        Dim MergeRec(1 To 1, 1 To 12) As Variant
        
        LastRec = Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
        Set TitleList = Sheets("Sheet1").Range("A2:A" & LastRec)
        
        For CurrentRec = 2 To LastRec
            TestTitle = Sheets("Sheet1").Cells(CurrentRec, 1).Value
            MergeRec(1, 1) = TestTitle
            
            'count the occurances of each title in the list
            TitleCount = Application.WorksheetFunction.CountIf(TitleList, TestTitle)
            
            FieldPtr = 1
            For Ndx = CurrentRec To CurrentRec + TitleCount - 1
                
                'check each field of each record, if not blank copy to mergerec
                FieldPtr = FieldPtr + 1
                If Sheets("sheet1").Cells(Ndx, FieldPtr).Value <> "" Then
                    MergeRec(1, FieldPtr) = Sheets("sheet1").Cells(Ndx, FieldPtr).Value
                End If
            Next Ndx
            DestRow = DestRow + 1
            
            'copy mergerec to sheet 2
            Sheet2.Cells(DestRow, 1).Resize(, 12) = MergeRec
            
            ' skip down to the next unique title
            CurrentRec = CurrentRec + TitleCount - 1
        Next CurrentRec
        
        'copy the header
        Sheet1.Range("a1").Resize(, 12).Copy Sheet2.Range("A1").Resize(, 12)
    End Sub
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. moving data to another sheet based on data in a specific cell
    By Dandrewhill in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-20-2016, 03:30 AM
  2. [SOLVED] Copying data entries in one row, to separate rows, while also moving their auxiliary data
    By bqeuux in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-20-2015, 11:52 AM
  3. Replies: 0
    Last Post: 10-25-2013, 12:14 PM
  4. Replies: 2
    Last Post: 02-06-2012, 08:21 PM
  5. Sorting, finding dulicates, moving one data element up, deleting original data
    By rickwtx in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 01-13-2011, 07:32 PM
  6. Replies: 1
    Last Post: 11-22-2010, 07:03 PM
  7. Replies: 1
    Last Post: 04-26-2009, 08:16 PM

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