Searching a spreadsheet using a vba form

A

anb001

I have a spreadsheet, with three column with data. I would like to b
able to search for specific data (or values) using a form made in VBA
On the form, there are three text boxes, one for each column. If
enter data in textbox1, it should search for this in column 1 in th
spreadsheet. Same goes for the other textboxes/columns.

When having entered data in one textbox, the other two should be graye
out, in order not to b able to enter data in those.

Have attached a file for easy reference.
Any help will be appreciated

Attachment filename: eurcos.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=59165
 
B

BrianB

There are a couple of possible variables to exactly what you want t
achieve. You may need to come back. This is the basic search :-


Code
-------------------
Private Sub CommandButton1_Click()
Dim foundcell As Object
myvalue = TextBox1.Value
Set foundcell = ActiveSheet.Columns(1).Find(myvalue)
If foundcell Is Nothing Then
MsgBox ("Not found.")
Else
foundcell.Select
End If
End Sub
 
A

anb001

BrianB,
That worked fine. There is a few other things I need as well:

1. When searching for the value in textbox1, there might be more cell
with the same result than just one. I need all cells to be selected.

2. As mentioned, there are three textboxes in the form, and only th
one with a value in it, should be used for the search. How is tha
done?

Thnks
 

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