+ Reply to Thread
Results 1 to 3 of 3

Lookup and update or add rows.

  1. #1
    Registered User
    Join Date
    12-23-2006
    Posts
    2

    Lookup and update or add rows.

    Friends,

    I am new to VBA. I need a help in the following :


    I have 2 spreadsheets :


    A) Workbook A :


    C1, C2, C3, C4, C5
    R1
    R2
    R3
    R4
    R5


    B) Workbook B


    C1, C3, C5
    R1
    R2
    R3


    Note the following :


    1. Workbook A has more columns and rows (new rows).
    2. Both workbooks will have data


    My Requirement:


    I want to update Workbook B with following requirements:


    1) Look for all existing rows and columns of Workbook B in Workbook A
    and then update Workbook B with latest values for those already
    existing and then add new rows with only required columns (C1, C3 & C5)
    of new rows.
    2) I also would like to capture the changes made to existing rows.

    As this is a routine job for me, I would like to write a VBA code to save time.

    My advance thanks to those who will help me on this.

  2. #2
    Forum Contributor vikas.bhandari's Avatar
    Join Date
    04-07-2006
    Location
    Delhi, India
    MS-Off Ver
    Office 2007 and 2010
    Posts
    303
    I need some more information...

    You mean to say that suppose if you have any value in R1C1 in sheetA, then it should be automatically reflected to Sheet B??? Do you want to put some conditions while checking for example, first of all you see the column headings..then to update the values, or you want to update the every value from Sheet A to Sheet B????

    Can you attach any example files??? That would help us a lot

    for capturing, Track Changes is always a best option.

  3. #3
    Forum Contributor
    Join Date
    07-05-2006
    Location
    Canada
    MS-Off Ver
    2003, 2007
    Posts
    581
    You can probably do it with something like this: (I made an assumption about how you determine if
    a row already exists)

    NOTE: Edited to add the bit about updating values if there are changes to existing values.


    Please Login or Register  to view this content.
    Scott
    Last edited by Maistrye; 12-26-2006 at 02:37 AM.

+ 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