Results 1 to 3 of 3

Matching Values in Two Sheets for Databasing

Threaded View

  1. #1
    Registered User
    Join Date
    03-27-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    5

    Angry Matching Values in Two Sheets for Databasing

    Hi all,

    Another question I'm hoping to get answered by the community!

    My need (see attached file to work with):
    1. Check each cell value in sheet LWDB column A to the column A in sheet MyDB
    2. If found take that cell values entire row of data (LWDB sheet), insert data row below found value (MyDB sheet) and offset one column (being data to start in column B)
    3. If cell value in LWDB not found, add that value to list (with formatting in MyDB) to MyDB then add the LWDB row below it
    4. Continue through loop to all items have been addressed.


    My code:
    Sub Databasing()
    '
    ' Databasing Macro
    '
    '
        Dim c As Range, d As Range
        Worksheets("LWDB").Activate
        For Each c In Range("A2:A15")
            For Each d In Worksheets("MyDB").Range("A2:A30")
                If c = d Then
                    c.EntireRow.Copy
                    d.Offset(1, 0).Insert Shift:=xlShiftUp, CopyOrigin:=True
                End If
            Next
        Next
            
    End Sub
    My thoughts: I have had my code work for points 1 & 2 on sample of 5, however the matching code crashes due to processing past this amount! Would it be better to use some sort of Array or any other thoughts on cutting this down as the databasing could be up to 400 entries.

    Appreciate the help
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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