![]() |
Searching a spreadsheet using a vba form
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 -- Message posted from http://www.ExcelForum.com |
Searching a spreadsheet using a vba form
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 ------------------- -- Message posted from http://www.ExcelForum.com |
Searching a spreadsheet using a vba form
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 -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 08:29 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com