Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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.


--
dkenebre


------------------------------------------------------------------------
dkenebre's Profile: http://www.excelforum.com/member.php...nfo&userid=760
View this thread: http://www.excelforum.com/showthread...hreadid=395574

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use MS Query to query data within the current work book Steve Kesler Excel Discussion (Misc queries) 0 August 6th 09 05:22 PM
Importing Data via Web Query - Can values be passed to query? [email protected] Excel Discussion (Misc queries) 5 May 9th 06 06:21 PM
Save data retreived from query without saving query Anthony Excel Discussion (Misc queries) 0 January 25th 06 07:17 PM
VB code + Data Validation query Jennyc114 Excel Programming 6 July 5th 05 11:28 AM
VB Code for MS Query Gustavo[_4_] Excel Programming 3 June 25th 04 08:57 PM


All times are GMT +1. The time now is 06:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"