Searching unknown number of cells for a value

A

Andrea

I'm working to improve our departments accuracy when taking customer
orders. The company I work for is rather new and so I'm armed only
with excel to solve many of the problems we experience. I've found
macros to be extremely useful, and I know just enough VBA to edit the
macros so they function exactly how I want them to. My current
problem is this, we have outstanding issues with some customers that
need to be resloved, and the best time to take care of these issues is
to speak with them when they call in to order.

Right now, we have a list of customer names that our phone operators
look through. The list is growing and they aren't being as diligent
about checking the list. What I would like to do is put customer
numbers and names in an excel sheet along with the order form, and
when the operator processes the order, and puts in the customer
information, they can use a command button which will run down the
list and check to see if the customer is on it, and respond with
message box. I know how to get the command button to work and also
the message box. What I really need to know is what is the most
efficient way to take a value, say the customer number, and search
through another sheet in the same workbook to see if they are on the
list. Any help or code snipits that anyone can provide will be
greatly appreciated.
 
T

Tom Ogilvy

Dim rng as Range
Dim sTarget as String
sTarget = "CustomerID"
set rng = worksheets("sheet2").Cells.Find(what:=sTarget)
if not rng is nothing then
msgbox sTarget & " was found"
Application.Goto Reference:=rng, scroll:=True
Else
Msgbox sTarget " was not found"
End If
 

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