+ Reply to Thread
Results 1 to 4 of 4

LOOK UP, COPY PASTE into Another Sheet Within SAME Workbook - with TODAY Date

  1. #1
    Registered User
    Join Date
    11-03-2004
    Posts
    75

    Question LOOK UP, COPY PASTE into Another Sheet Within SAME Workbook - with TODAY Date

    Need help expanding this code to make it do the following:
    1. Start w/ "RULE-Table" sheet,
    2. Take note of "TODAY" date,
    3. LOOKUP date in "RULE-table"
    4. Locate Coordinates found in Col D of RULE-Table,
    5. LOOKUP the data that resides in those Coordinates on the "PRODUCTION" sheet & COPY
    6. PASTE data into "REPORT" tab C2 and E2.

    Here's an example to help visualize:
    Code will do everything it needs to do within an Undisclosed OPEN file with several sheets.
    The reason the Workbook file name is undisclosed/undefined is because the file name will vary based on clients, so I don't want the code to be limited to look for a specific filename.

    *The sheet names within this OPEN client file will always have the same names.


    The sheet called: "RULE-Table" holds coordinates based upon "TODAY's" computer date.
    For example: If today is JAN 4, the desired coordinates to pull data from are "B5" and "D10" from the "PRODUCTION" sheet.


    "RULE-Table" sheet
    A......B.........C................D.......
    Row1.DAY....WK RANGE....QTR RANGE
    2......1/1.......1...............B2,D7
    3......1/2.......1...............B3,D8
    4......1/3.......1...............B4,D9
    5......1/4.......1...............B5,D10
    6......1/5.......1...............B6,D11

    Since today is 1/4, its rules say go to B2 and D10 of the PRODUCTION tab and collect the data

    "PRODUCTION" (data source) sheet (within the same open file)
    A.......B......C....D....E....F...
    Row1..Header..Hdr..Hdr..Hdr..Hdr.
    2.......2.................................
    3.......14...............................
    4.......13...............................
    5.......20...............................
    6.......62..............................
    7....................76.................
    8...................184................
    9...................375................
    10.................410................
    11.................525...............

    Last, the collected data from those 2 coordinates should always get pasted onto the "REPORT" tab
    into C2 and E2 in this example.

    "REPORT" (destination) sheet (within the same open file)
    A........B.........C.....D....E.....
    Row1..Header..Hdr..Hdr..Hdr..
    2...................20........410......

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    11-03-2004
    Posts
    75

    Re: LOOK UP, COPY PASTE into Another Sheet Within SAME Workbook - with TODAY Date

    bump - still looking for help on this

  3. #3
    Registered User
    Join Date
    11-03-2004
    Posts
    75

    Re: LOOK UP, COPY PASTE into Another Sheet Within SAME Workbook - with TODAY Date

    I've got this piece of code that is performing the action of extracting the result and pasting it to the "REPORT" tab, however, it is erroring out with the dreaded "#N/A".... because the formula / function is getting converted/corrupted as it pastes itself into "C2" and "E2"....


    Please Login or Register  to view this content.


    Does anyone know how to keep it from corrupting?

    When I look at the formula in "C2" after it pastes to the "REPORT" sheet, the function/formula converted itself a tiny bit -- here's what it ends up looking like:
    =INDIRECT(CONCATENATE("Production!",(LEFT(VLOOKUP(TODAY(),'RULE-Table'!D:F,3,0),FIND(",",VLOOKUP(TODAY(),'RULE-Table'!D:F,3,0),1)-1))))

    The same is true for the "E2" paste:
    =INDIRECT(CONCATENATE("Production!",(RIGHT(VLOOKUP(TODAY(),'RULE-Table'!D:F,3,0),LEN(VLOOKUP(TODAY(),'RULE-Table'!D:F,3,0))-FIND(",",VLOOKUP(TODAY(),'RULE-Table'!D:F,3,0),1)))))



    I've seen this happen before and someone told me if I'll put a "$" in front of the reference, it should keep it from converting...
    I attempted that, (I put a dollar sign in front of each of your "C" references) like this:
    "=INDIRECT(CONCATENATE(""Production!"",(LEFT(VLOOKUP(TODAY(),'RULE-Table'!$C[-1]:$C[1],3,0),FIND("","",VLOOKUP(TODAY(),'RULE-Table'!$C[-1]:$C[1],3,0),1)-1))))"
    Range("E2").Select

    ...but it did not work, instead it caused it to error out when it gets to that line using "F8" to step through it...
    Run Time Error 1004: Application defined or Object defined

    Any ideas how to keep it from changing itself???

  4. #4
    Registered User
    Join Date
    11-03-2004
    Posts
    75

    Re: LOOK UP, COPY PASTE into Another Sheet Within SAME Workbook - with TODAY Date

    I think it must have to do with this section: 'RULE-Table'!C[-1]:C[1],3,0),FIND

    Can someone tell me what this breaks down to?
    Assume C............ = Column C
    ...........C[-1]...... = Column C minus 1 (which is Column B)
    ...........C[1]....... = Column C plus 1 (which is Column D)
    .......... ,3........ ?
    .......... ,0........ ?

    Am I interpreting this correctly?

+ 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. Copy, Paste loop based on today's Date
    By oscarmiike in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-22-2014, 09:05 PM
  2. [SOLVED] Macro needed to copy rows from sheet1 and paste to sheet2 if date in colmn h is >today
    By Rekoons38 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-10-2014, 12:44 PM
  3. [SOLVED] When workbook open it show the sheet have today date
    By robrobet in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-24-2013, 11:00 AM
  4. [SOLVED] Copy rows where date is equal TODAY and move them to another workbook
    By testingandroid in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-31-2012, 03:51 AM
  5. [SOLVED] VBA to copy specific data from one workbook to another based on today's date?
    By hiprhit in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-09-2012, 02:21 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