+ Reply to Thread
Results 1 to 2 of 2

VBA to compare master table to subordinate datasheets and update values

  1. #1
    Registered User
    Join Date
    07-06-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    12

    VBA to compare master table to subordinate datasheets and update values

    Greetings Excel Masters,

    Any assistance on this project would be greatly appreciated.

    The macro that I am trying to build would compare the following –

    Column A on (“Emp Info”) = Master Sheet
    Column A on (“Emp Data Production”)
    Column A on (“Emp Data Quality”)
    Column A on (“Emp Data PHI”)
    Column A on (“Emp Data PQL Errors”)

    If column A on (“Emp Info”) has a value that is not on either of the other sheets, I need the macro to add the Values from Columns A,B,C to the next blank row on the deficient sheet(s).

    If column A on (“Emp Info”) does not have a value that is on any of the other sheets, I need the macro to remove the Value and Clear the row.

    Thanks in advance for your assistance,
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    07-06-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: VBA to compare master table to subordinate datasheets and update values

    This code compares Column A on (“Emp Info”) = Master Sheet with Column A on (“Emp Data Production”) if the data does not exist it deletes the row in (“Emp Data Production”). This can be adapted to include the other sheets.


    Sub Test1()

    Dim LastRow As Long
    Dim ThisRow As Long
    Dim Range2 As Range

    Sheets("Emp Info").Select
    ' Range2 is the target range which is checked for matching value
    Set Range2 = Range(Range("A2"), Range("C65536").End(xlUp))
    Sheets("Emp Data Production").Select
    LastRow = Range("C65536").End(xlUp).Row
    ' The original range is looped and rows which do not contain a march are deleted
    For ThisRow = LastRow To 2 Step -1
    If Application.WorksheetFunction.CountIf(Range2, Range("A" & ThisRow).Value) = 0 Then Range("A" & ThisRow).EntireRow.Delete
    Next ThisRow

    End Sub


    Any help on the following would be appreciated...

    If a new value is added to Column A on (“Emp Info”) = Master Sheet, I need the macro to add the value of columns "A:C"(“Emp Info”) to "A:C" (“Emp Data Production”) first empty row.


    Thanks for your assistance.

+ 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. Replies: 5
    Last Post: 10-26-2013, 01:03 PM
  2. Replies: 0
    Last Post: 03-04-2013, 03:40 AM
  3. Update Master Table
    By Nick Danger in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-24-2009, 12:23 PM
  4. Linking Master Workbook & subordinate workbook
    By Lucky_guy2000 in forum Excel General
    Replies: 1
    Last Post: 07-14-2006, 05:45 PM
  5. [SOLVED] Compare master list and update
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2005, 01:05 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