+ Reply to Thread
Results 1 to 8 of 8

Match one cell with another, if match found copy adjacent cells

  1. #1
    Registered User
    Join Date
    03-18-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003 - 2007
    Posts
    11

    Match one cell with another, if match found copy adjacent cells

    Hi Everyone,

    Looking for a solution to an idea I have had about a macro on one of my worksheets.

    In total I have 5 work sheets; 3 source sheets, 1 dashboard sheet and a Master data sheet. The 3 source sheets are just dumps of information from other sources, the Master sheet pulls all the relevant data from the 3 source sheets and the dashboard uses the data found on the master sheet and makes it look pretty for the managers. Data on the master sheet runs down columns per day, and is just sums and averages of what the different people have achieved over the course of that day.

    At the top of the master sheet, I have frozen some cells and placed in a "Previous" day area, which is where the dashboard graphs and charts pull their information from.

    What I would like, is for a Macro (or a function/formula if possible) to take the current date in Cell B3 and search down Column B for a match of that date and when found to copy everything from C*Matched row* to Y*Matched row* and paste it to C3 to Y3. Cell B3 contains a =Today()-1 formula so that yesterday's date is always displayed.

    Thanks in advance.

    I have done some light reading on Hlookup, Match and the index functions but I am unsure of how I would proceed or even begin using them.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Match one cell with another, if match found copy adjacent cells

    attach a sample file with current and desired situation
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    03-18-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003 - 2007
    Posts
    11

    Re: Match one cell with another, if match found copy adjacent cells

    Here you go.

    I have removed all sensative data, hence the almost empty spreadsheet. Hopefully it conveys what I would like to achieve.

    Thanks for your assistance.

    Sample Spreadsheet.xlsx

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Match one cell with another, if match found copy adjacent cells

    Please note that the code is an event driven one. When you change the date in master sheet (B3), the code shows you the message and if there is a date match, the rows will be copied in to C3.
    The code resides in master sheet not on standard code. I have tested it and it works, but events behave in strange way.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-18-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003 - 2007
    Posts
    11

    Re: Match one cell with another, if match found copy adjacent cells

    Thanks AB33 it is working.

    But is there a way to specify the paste function paste as vaule only and not do a straight copy? As it is copying up my offset formulas and because they are moving up, the cell references are changing.

    Thanks for the awesome solution so far.

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Match one cell with another, if match found copy adjacent cells

    Change this line

    Please Login or Register  to view this content.
    INTO

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-18-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003 - 2007
    Posts
    11

    Re: Match one cell with another, if match found copy adjacent cells

    Legend. Thanks.

    *'rd.

    When will this event run, when the document is opened? or when someone navigates to the Master tab?

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Match one cell with another, if match found copy adjacent cells

    The code is fired when you change the date(B3). If you do not touch B3, nothing happens.

+ 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