Thread
:
VBA Function for Match and Offset
View Single Post
#
2
Posted to microsoft.public.excel.programming
Don Guillett
external usenet poster
Posts: 10,124
VBA Function for Match and Offset
Try this idea where your list to find is in col g starting at row 5 and you
are looking in col H.
Sub findit()
'On Error Resume Next
For i = 5 To Cells(Rows.Count, "g").End(xlUp).Row
myvalue = Columns("h").Find(Cells(i, "g")).Offset(, 3)
MsgBox myvalue
Next i
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Jaybird" wrote in message
...
Hello, VBA moron here... I have two formulas (Match and Offset) in
Excel which allow me to reproduce cells containing information in one
worksheet on another. Basically, we have a long list of
identification numbers (4500+) with information about that product in
one worksheet called: Prealert. Our customer sends us this huge list
(a database table, really) with all of the stuff they want to send us
all month long. We are supposed to verify the product that comes in
is on this list and reproduce the relevant information on another
worksheet I call: Match. The formulas I am currently using a
=MATCH($A2,Prealert!$H$2:$H$31,0) to find the row number from Column H
containing the ID number we are looking for
And,
=OFFSET(Prealert!$H$1,$B2-1,0) to reproduce the cells of that row
containing important information
This works pretty well if you understand the formula. The other users
and my lead do not understand it.
I figured that I might get an 'Attaboy' at work if I could figure out
an easy way for them to use these formulas. My first thought was to
come up with a VBA program. The problem is that I don't know what I'm
doing.
The questions I've managed to come up with so far:
What sort of function will I need?
How do I declare my variables?
Should I use an input box to input the ID number?
How do I call up the function once it works?
What sort of error trapping will I need?
Important facts that will likely affect the answers:
The users will most likely open the spreadsheet, activate the function
and begin to scan the ID numbers in. It would help if there were an
audible for missed scans and for invalid inputs, and for items that
aren't on the prealert so that the user can keep scanning until they
detect a problem.
Thanks to anyone who can steer me in the right direction.
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett