Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel found unreadable content sb07 Excel Discussion (Misc queries) 1 March 4th 10 01:19 PM
Excel found unreadable content Greg Creme Excel Programming 0 December 2nd 09 08:46 PM
Excel found unreadable content Erika Excel Discussion (Misc queries) 0 November 17th 09 08:21 PM
excel found unreadable content in file..... do you want to recover madds Excel Discussion (Misc queries) 4 September 1st 09 07:21 PM
Excel found unreadable content: auto.pilot Excel Discussion (Misc queries) 1 January 19th 08 07:04 PM


All times are GMT +1. The time now is 03:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"