Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using VBA code when searching in a spreadsheet
I have a form in an excel spreadsheet, with two textboxes and one comb
box. I have below code, which will search for values given in the combobox. Private Sub CommandButton1_Click() Dim foundcell As Object myvalue = ComboBox1.Value Set foundcell = ActiveSheet.Columns(1).Find(myvalue) If foundcell Is Nothing Then MsgBox ("Not found.") Else foundcell.Select End If End Sub If e.g. the comobox1 is empty, it should look for a value in textbox1 and search for that in column(2) in the spreadsheet, and if that als is empty, it should look for the value in textbox2, and search for tha in column(3) in the spreadsheet. Help is badly needed. Thnks -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Searching Multiple Timesheets for a project code and then.... | Excel Worksheet Functions | |||
VBA code to searching for a folder | Excel Discussion (Misc queries) | |||
searching by number or code ina work book | Excel Discussion (Misc queries) | |||
Searching range for value (code written but needs 'tweaking'!) | Excel Programming | |||
Searching for VB Code to Link to Program | Excel Programming |