IDing cells in one worksheet, find them in another, and copying respective data

C

cwatson

From what I gather this is extremely complicated, so I am grateful for
any attempt to answer:

Refer to attachment 1: here you see a listing of sensors and their
values the sensor is the first string and the underlying value is after
the underscore ie: sensor=PGA-HCF-nasalC-10aUB-s2 and the value is
_signal.

that worksheet contains every B sensor, evidenced by
PGA-HCF-nasalC-10aU*B* -s2

there is another worksheet called 'a' that has all the a sensors:
PGA-HCF-nasalC-10aU*A* -s2

the number '10' changes in each sensor...ie: PGA-HCF-nasalC-*11*aU*A*
-s2 may be another sensor.

This raw data contains many more sensors and values than ill ever need,
so a list of the necessary sensors is in a worksheet called 'sensors'.
refer to attachment 2
this worksheet contains sensors with different numberical values (the
10) and both a and b

what i need to do is essentially identify each sensor in the sensors
worksheets and search for the three columns in the 'a' or 'b' worksheet
that contain that sensor, copy those columns and paste them into a new
worksheet.

the raw data goes down 23,000 rows btw.

thank u all!
AIM me @ decept1on or post here if u have any insight or need
clarification.


+-------------------------------------------------------------------+
|Filename: 2.GIF |
|Download: http://www.excelforum.com/attachment.php?postid=3532 |
+-------------------------------------------------------------------+
 
M

MrShorty

Here's a start:

In the sheet represented by 2.gif:
A2=2, A3=3, etc. using autofill or other tool
B2=HLOOKUP(B$1,Adata!$A$1:$AA$23000,$A2,FALSE) copy to H2
E2=HLOOKUP(B$1,Bdata!$A$1:$AA$23000,$A2,FALSE) copy to K2
copy row 2 down as far as you need.

Does that do what you want, or did misunderstand what you need?
 
C

cwatson

im confused, where do I put that code?

im going to make a sample sheet that doesnt use so much data so i ca
host the xml files perhap
 
C

cwatson

it just pastes the plain tex
'B2=HLOOKUP(B$1,Adata!$A$1:$AA$23000,$A2,FALSE) copy to H2' into th
cell B2, not like formulae or anytihn
 
M

MrShorty

When entering the formulas, don't include single quotes or the initia
B2. Just enter =HLOOKUP(....
 
C

cwatson

Code:
--------------------
Function Find_Range(Find_Item As Variant, _
Search_Range As Range, _
Optional LookIn As Variant, _
Optional LookAt As Variant, _
Optional MatchCase As Boolean) As Range

Dim c As Range
If IsMissing(LookIn) Then LookIn = xlValues 'xlFormulas
If IsMissing(LookAt) Then LookAt = xlPart 'xlWhole
If IsMissing(MatchCase) Then MatchCase = False

With Search_Range
Set c = .Find( _
What:=Find_Item, _
LookIn:=LookIn, _
LookAt:=LookAt, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=MatchCase, _
SearchFormat:=False)
If Not c Is Nothing Then
Set Find_Range = c
firstAddress = c.Address
Do
Set Find_Range = Union(Find_Range, c)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With

End Function

Sub poo()
ActiveCell.Select
a = ActiveCell.Text
Sheets("A").Select
Find_Range(CStr(a), Range("A1:Z1")).Select


Application.Run "achip.xml!downdown"


End Sub

Sub downdown()
For Each Cell In Selection

Range(ActiveCell, ActiveCell.End(xlDown)).Select

Next

End Sub
--------------------



that is what i have so far, but it only selects the first searched
column

im running sub poo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top