+ Reply to Thread
Results 1 to 1 of 1

Code to query data

  1. #1
    Registered User
    Join Date
    09-13-2003
    Posts
    7

    Code to query data

    I need help creating this code, the code created works, but take too long to process, over 10 minutes. I need to execute to function faster.
    In “sheet1” how do I find the value generated by formula in ck145:ck148 in every instance from the source range (D5:IT7) in sheet2 named “ Sheet 11 ” and copy the contents in this sheet from the cell in the previous column on the same row as the match to “sheet1”, in the CL column starting on (row 145 for ck145 matches) and (row 146 for ck146 matches) and (row 147 for ck147 matches) and (row 148 for ck148 matches) .
    Also, I have other worksheets I would like to update the code to query data from into sheet 1.
    rngArray = Array("D5:IT7", "D5:IT28", "D5:IT144", "D5:IT645") : sheet 11, 12, 13 and 14
    OPArray = Array("ck145:ck148", "ck149:ck152", "ck153:ck156", "ck157:ck160") :sheet1
    a = Sheets("sheet " & 11 + n).Range(rngArray(n)).Value : sheet 11, 12,13 and 14

    The values in ck145:ck160 are preselected by a formula and should not be by this code. The code should go and find the matches to the values generated by the formulas from ck145:ck160 in sheet1, to those in sheet 11, 12, 13 and 14, and place the content from the cell in the previous column same row in each instance into the CL column of sheet1.
    For example if ck145=10 in sheet1, go to sheet 11 and find all matches in the selected range that equal 10, then for each true occurrence, copy the content in the cell from the previous column on the same row and paste into sheet1 starting at CL145.
    Use the same function for whatever value is generated (eg. =MAX('Sheet 11'!$D$5:$IT$7)), in ck146, ck147 and ck148. Find the values from those cells in sheet 11, then for each true occurrence, copy the content in the cell from the previous column on the same row and paste into sheet1 starting at CL146 for the matches to ck146 and CL147 for the matches to CK147 and CL148 for the matches to CK148.
    Also, the content output should be listed in numerical order.
    example 1,3 before 6,16 or 9,10 before 13,21
    Last edited by dkenebre; 08-13-2005 at 02:34 PM.
    dK

+ 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