Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Display "Does not exist" upon search no results

Hi,

I'd like my search looping in VBA to display a message that says that the
identification written does not exist in the list. It must be something like
"On Error GoTo MsgBox" To I imagine. But I don't know hw to write it.
Thx

JJD

--
Message posted via http://www.officekb.com
  #2   Report Post  
Posted to microsoft.public.excel.programming
Naz Naz is offline
external usenet poster
 
Posts: 85
Default Display "Does not exist" upon search no results

On error go to ErrorHandler


ErrorHandler:
Msgbox "error message"




--

_______________________
Naz,
London


"Jean-Jerome Doucet via OfficeKB.com" wrote:

Hi,

I'd like my search looping in VBA to display a message that says that the
identification written does not exist in the list. It must be something like
"On Error GoTo MsgBox" To I imagine. But I don't know hw to write it.
Thx

JJD

--
Message posted via http://www.officekb.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Display "Does not exist" upon search no results

Give this a try...

Public Sub SearchList()
Dim wks As Worksheet
Dim rngCurrent As Range
Dim rngToSearch As Range

Set wks = Sheets("Sheet1")
Set rngToSearch = wks.Range("A1", "A100")

Set rngCurrent = rngToSearch.Find("This")
If rngCurrent Is Nothing Then
MsgBox "Not Found"
Else
MsgBox rngCurrent.Address
End If

End Sub
--
HTH...

Jim Thomlinson


"Jean-Jerome Doucet via OfficeKB.com" wrote:

Hi,

I'd like my search looping in VBA to display a message that says that the
identification written does not exist in the list. It must be something like
"On Error GoTo MsgBox" To I imagine. But I don't know hw to write it.
Thx

JJD

--
Message posted via http://www.officekb.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Display "Does not exist" upon search no results

Thanks Jim Thomlinson and Naz! It was the little spark of light needed to
achieve my goal.

Have a good day!

JJD

--
Message posted via http://www.officekb.com
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
search for text "beginning with" "containing" wildcards David H Excel Worksheet Functions 1 January 13th 10 01:24 PM
=IF(ISNUMBER(SEARCH("ELB",B2)),"Pipe") add more like "ELB" "FLG" MAHMOUD Excel Worksheet Functions 5 September 6th 09 06:04 PM
=IF(ISERROR(SEARCH("insurance",A125,1)),"","*") cynichromantique Excel Worksheet Functions 9 September 25th 08 09:49 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
How do I change the column heading in Excel to display "A" "B" "C Thai New Users to Excel 1 November 30th 07 08:06 PM


All times are GMT +1. The time now is 08:45 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"