+ Reply to Thread
Results 1 to 7 of 7

Using Match and Address within Macro/VBA

  1. #1
    Registered User
    Join Date
    07-18-2016
    Location
    US
    MS-Off Ver
    2007
    Posts
    16

    Using Match and Address within Macro/VBA

    I have 2 worksheets "Data" and "P558 Main FE Defects"

    In "Data" I want to be able to click a button and paste "E46" into the correct location in "P558 Main FE Defects". I am able to find the value of a given cell with this formula, but what I am needing is the address so I know where to copy and paste "E46" to. Here is the formula that gives me the value of the cell...

    =INDEX('P558 Main FE Defects'!B2:AF45,MATCH(Data!D2,'P558 Main FE Defects'!A2:A45,0),MATCH(Data!A2,'P558 Main FE Defects'!B1:AF1,0))

    Once I find the address of this cell I want to paste the value of "Data!E46" into this location. I am somewhat new to VBA/Macros and was wondering if anyone could help?

    Data.PNG ("Data")
    P558 Main FE Defects.PNG ("P558 Main FE Defects")
    Last edited by hthoma11; 07-18-2016 at 02:30 PM. Reason: adding images

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,946

    Re: Using Match and Address within Macro/VBA

    That is really a better job for a pivot table. Use the table on Data (A:E) as your source, with Defect as the row field, Date as the column field, and Qty as the data field.

    You could use looping code to produce the table by processing all of column E - do you really want the button to do just one row?

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    07-18-2016
    Location
    US
    MS-Off Ver
    2007
    Posts
    16

    Re: Using Match and Address within Macro/VBA

    This works great! Thank you for your help! I ended up just populating all rows at once versus one row at a time.

  4. #4
    Registered User
    Join Date
    07-18-2016
    Location
    US
    MS-Off Ver
    2007
    Posts
    16

    Re: Using Match and Address within Macro/VBA

    What if I wanted to add shifts like you see in the images I have posted below? I tried using the same macro but it kept placing all the information in the 1st Shift Column. In the total column is the sum formula for shifts 1-3.

    Data.PNG(Data)

    P558 Main FE Defects.PNG(P558 Main FE Defects)
    Last edited by hthoma11; 07-19-2016 at 07:55 AM.

  5. #5
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,946

    Re: Using Match and Address within Macro/VBA

    Try changing

    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    07-18-2016
    Location
    US
    MS-Off Ver
    2007
    Posts
    16

    Re: Using Match and Address within Macro/VBA

    Perfect! One more thing and I promise I will leave you alone. The values in Column C in "Data" tells me which sheet to paste this information on. How would I write the macro to look at the value in C before decided where to paste it? For example if C3 said P558 Main BE instead of P558 Main FE, i would want it to go to the sheet "P558 Main BE Defects" to paste it. I would want it to do this for all of Column C.

  7. #7
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,946

    Re: Using Match and Address within Macro/VBA

    Please Login or Register  to view this content.

+ 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. Partial name and address match
    By psingh2688 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-10-2015, 12:12 PM
  2. Using macro to find email address in address book of Outlook
    By danfullwood in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-22-2014, 06:48 AM
  3. can i use address and match to get address of table i want to write to
    By teacher_rob in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-10-2011, 07:22 PM
  4. Offset, Address & Match
    By veeru_php in forum Excel General
    Replies: 1
    Last Post: 06-28-2011, 03:13 AM
  5. If function using address/match
    By STarloff in forum Excel General
    Replies: 2
    Last Post: 03-16-2011, 04:37 PM
  6. Indirect address/match
    By Prcntrygrl in forum Excel General
    Replies: 4
    Last Post: 08-26-2009, 05:05 PM
  7. Address Match
    By ems.payroll in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-22-2008, 04:05 PM

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