+ Reply to Thread
Results 1 to 2 of 2

Macro to only change specific cells

  1. #1
    THT
    Guest

    Macro to only change specific cells

    Hi,

    This is a follow up question to a previous question I had around macros.
    Not sure if I should use a macro or a function in this case.

    I have File 1 (master file) with a total of 1000 rows, and File 2 (which
    contains 20 of the 1000 rows) -- identical columns

    For example:

    File 1

    Name ID
    A 1
    B 2
    C 3
    D 4
    E 5

    File 2
    Name ID Changed (extra column)
    A 1 No
    C 6 Yes
    D 4 No

    How can I create a macro/function to only change the ID cell for "C"? I
    have inserted a "changed" column in File 2 to help me identify those that
    have changed.

    Thanks!


  2. #2
    JulieD
    Guest

    Re: Macro to only change specific cells

    Hi

    not sure if this is the best way to approach this, but one option would be
    (ensure both files are open)
    in File 1 column C use the formula
    =IF(ISNA(VLOOKUP(A2,[File2]Sheet2!$A$2:$B$20,2,0)),B2,VLOOKUP(A2,[File2]Sheet2!$A$2:$B$20,2,0))
    and copy the formula down (move your cursor over the bottom right hand
    corner of the cell, when you see a +, double click) all of column C in File
    1 - this will put the value in from File 2 if there is one, or it will put
    the value in from column B if the value isn't found in File 2.

    Once you've checked the results in column C, you can copy them and then edit
    /paste special - values back over column B if you so wish.

    --
    Cheers
    JulieD
    check out www.hcts.net.au/tipsandtricks.htm
    ....well i'm working on it anyway
    "THT" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > This is a follow up question to a previous question I had around macros.
    > Not sure if I should use a macro or a function in this case.
    >
    > I have File 1 (master file) with a total of 1000 rows, and File 2 (which
    > contains 20 of the 1000 rows) -- identical columns
    >
    > For example:
    >
    > File 1
    >
    > Name ID
    > A 1
    > B 2
    > C 3
    > D 4
    > E 5
    >
    > File 2
    > Name ID Changed (extra column)
    > A 1 No
    > C 6 Yes
    > D 4 No
    >
    > How can I create a macro/function to only change the ID cell for "C"? I
    > have inserted a "changed" column in File 2 to help me identify those that
    > have changed.
    >
    > Thanks!
    >




+ 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