Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Response to txtbox content if not found in the worksheets: Excel V
Hi,
Everyone, I've a worksheet in a workbook that has a Search text Box created from the control box. I'd like to know the code that generates Msgbox "Data not found!!", when the search button is clicked. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Response to txtbox content if not found in the worksheets: Excel V
Add this to the relevant sheet code module:
Private Sub CommandButton_Search_Click() '''Search this worksheet for text in TextBox_Search '''If found, then activate cell, if not found, then display message Dim r As Excel.Range Set r = Me.Cells.Find(What:=Me.TextBox_Search, LookIn:=xlValues) If r Is Nothing Then MsgBox prompt:="Data not found!" Else r.Activate End If End Sub Change the control names as required. Cheers, Dave "Msgbox "Data not found"" wrote: Hi, Everyone, I've a worksheet in a workbook that has a Search text Box created from the control box. I'd like to know the code that generates Msgbox "Data not found!!", when the search button is clicked. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
excel found unreadable content | Excel Discussion (Misc queries) | |||
Excel found unreadable content | Excel Programming | |||
Excel found unreadable content | Excel Discussion (Misc queries) | |||
excel found unreadable content in file..... do you want to recover | Excel Discussion (Misc queries) | |||
Excel found unreadable content: | Excel Discussion (Misc queries) |