+ Reply to Thread
Results 1 to 8 of 8

Thread: Merge Multiple accounts to master list

  1. #1
    Registered User
    Join Date
    09-16-2008
    Location
    Canada
    MS-Off Ver
    Excel 2003 (silly work wont upgrade)
    Posts
    57

    Merge Multiple accounts to master list

    Hi Guys,

    Looking to merge multiple account numbers from multiple tabs onto the master list. I have attached a dummy sheet for you to see what I mean.

    Basically I need to get rid of all the accounts that come up more then once on all the sheets and just have it once on the master list. Any help would be greatly appreciated

    Thanks again
    Mikey
    Attached Files Attached Files
    Last edited by mikeydaman; 11-15-2011 at 10:34 AM. Reason: Solved

  2. #2
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,150

    Re: Merge Multiple accounts to master list

    Hi mikeydaman

    Try this Dictionary....
    Option Explicit
    Sub ptest()
        Dim n As Long, i As Long, xCell, ws As Worksheet, dic1 As Object
        
       Set dic1 = CreateObject("Scripting.Dictionary")
        dic1.CompareMode = 1
        For Each ws In Worksheets
            If Not ws.Name Like "Master list" Then
                With Worksheets(ws.Name)
                    For Each xCell In .Range("A1", .Cells(.Rows.Count, 1).End(xlUp))
                        If Not dic1.exists(xCell.Value) Then
                            n = n + 1
                            dic1.Item(xCell.Value) = n
                        End If
                    Next
                End With
            End If
        Next
        ThisWorkbook.Sheets("Master list").Cells(1).Resize(n, 1).Value = Application.Transpose(dic1.keys)
    
    End Sub
    regards pike

    If the solution helped please donate
    here to the RSPCA

    Sites worth visiting;

    J&R Solutions - royUK

    AJP Excel Information - Andy Pope

    Spreadsheet Toolbox

    VBA for smarties - snb

  3. #3
    Valued Forum Contributor Miraun's Avatar
    Join Date
    04-03-2009
    Location
    Location: Location
    MS-Off Ver
    Excel 2007
    Posts
    266

    Re: Merge Multiple accounts to master list

    Hey Pike;

    I know we're talking about saving a few miliseconds at best, but would it be faster to consolidate all of the information from each of the different months and then apply:
        ActiveSheet.Range("A:A").RemoveDuplicates Columns:=1, Header:=xlNo
    Rather than doing a cell by cell comparison?

    Although, that aside... impressive vba method. I'd have just said to manually copy all of the column As and then do the remove duplicates function under data.
    I '<3' reputation. If I helped, click the scales. This will be helping an internal departmental competition with co-workers.

    Reputation can be granted through the Scales Icon (for classic layout), or the little Star on the bottom of the post next to the blogging function for the new forum layout.

    If you're not busy, and really feel down on life, read my excel blog which may or may not have contents.

  4. #4
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,150

    Re: Merge Multiple accounts to master list

    Hi Miraun

    Yes, but i dont know which version of excel mikeydaman has.
    "RemoveDuplicates" is for 2007 and better .. but good thinking

    Location Location you must live near me ,, oh not with that IP address!
    regards pike

    If the solution helped please donate
    here to the RSPCA

    Sites worth visiting;

    J&R Solutions - royUK

    AJP Excel Information - Andy Pope

    Spreadsheet Toolbox

    VBA for smarties - snb

  5. #5
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: Merge Multiple accounts to master list

    Sub tst()
     With Sheets("Master list")
      For Each sh In Sheets
       If sh.Name <> .Name Then .Cells(Rows.Count, 1).End(xlUp).Offset(IIf(.Cells(1) = "", 0, 1)).Resize(sh.Columns(1).SpecialCells(2).Count) = sh.Columns(1).SpecialCells(2).Value
      Next
      .Columns(1).AdvancedFilter xlFilterCopy, , .Cells(1, 2), True
      .Columns(1).Delete
     End With
    End Sub



  6. #6
    Registered User
    Join Date
    09-16-2008
    Location
    Canada
    MS-Off Ver
    Excel 2003 (silly work wont upgrade)
    Posts
    57

    Re: Merge Multiple accounts to master list

    Hey Guys,

    Thanks for everyones input. I think Im going to do it the old fashioned way.
    Sorry I forgot to say that I use 2003 at work. I have 2007 at home and would have used the removed duplicates function. Im going to merge everything to the master list like Miraun said then..

    IF(COUNTIF($A$1:$A1,A1)>1,"Duplicate","Fine")

    Then filter and custom to equal Duplicate and delete them that way. This way I see each step to make sure Im not getting rid of something I shouldn't be

    Thanks for the VBA as well. Gives me options for future.
    Last edited by mikeydaman; 11-15-2011 at 10:48 AM.

  7. #7
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,150

    Re: Merge Multiple accounts to master list

    Hi mikeydaman
    can you please complete "MS Office Version" in your user profile
    regards pike

    If the solution helped please donate
    here to the RSPCA

    Sites worth visiting;

    J&R Solutions - royUK

    AJP Excel Information - Andy Pope

    Spreadsheet Toolbox

    VBA for smarties - snb

  8. #8
    Registered User
    Join Date
    09-16-2008
    Location
    Canada
    MS-Off Ver
    Excel 2003 (silly work wont upgrade)
    Posts
    57

    Re: Merge Multiple accounts to master list

    Done.. sorry bout that

+ 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