+ Reply to Thread
Results 1 to 1 of 1

Thread: macro to read descriptions, match in different worksheets and display values

  1. #1
    Registered User
    Join Date
    05-26-2009
    Location
    Spore
    MS-Off Ver
    Excel 2003
    Posts
    21

    macro to read descriptions, match in different worksheets and display values

    hi

    my project needs me to automate a quarter report based on some values provided. the old way is to copy paste which takes hours and it is a very excruciating process.
    i could use LOOKUP functions but it is very tedious and messy since pivot tables are involved.
    Attached is the sample workbook.

    i want to create a macro/ function that upon clicking a cell in 'Q2' worksheet, it will automatically read the description in the active cell's column row 3.
    it will then iterate to find its match in 'CD' worksheet row 2.
    if it has a match, the macro/ function will go back to 'Q2' and read the description in column B on the same row as the active cell (highlighted in orange).
    it will then refer back again to the 'CD' worksheet, this time in column A.
    once it finds its match and satisfies both descriptions, it will take the value that is provided in 'CD' and display into the active cell in 'Q2'.

    as for reading the desc that is highlighted in dark green, the macro/ function is supposed to read the desc in the active cell's column row 3.
    instead of finding its match in 'CD', it will find its match in 'SPCharge' in column A and take the value from column I of the matching row.
    the value will be displayed back into the active cell of 'Q2'.

    as for reading the desc that is highlighted in blue, the macro/ function is supposed to read the desc in the active cell's column row 3. it will then find its match in 'PivotDelin' column A and takes the value from column D of the matching row.
    the value will be displayed back into the active cell of 'Q2'.

    im only working on those rows with highlighted cells in column B in 'Q2'. however, these are just samples. the real data contains many other products thus, there will be more rows in 'SPCharge' more columns in 'CD'. likewise for 'Q2' as well.
    'SPCharge', 'PivotDelin' and 'CD' are supposedly pivot tables, but since i have to create a sample workbook, i copied and changed the numbers.
    the names of the worksheets are permanent and will not change so that it is
    easier to refer to and declare in the macro/ fucntion.
    for easier references, i highlighted the tab colour with the colour of the cells.
    i copied/pasted in the first few rows of 'Q2' so that the process looks clearer.

    can someone help me i this? i will appreciate it alot!
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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.2.0