LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default If no FIND value is found, then a Msgbox to say so and exit sub

Hello Excel users and experts,

Win XP, Excel 2002

A number is scanned into cell A1 and the below code is called through a
change event macro. It finds that value in range aList and a date stamp is
entered 2 columns to the right of the find value. This works fine.

However, if there is NOT a value found in aList, then for some reason the
date stamp is entered in first row of aList, 2 columns over. What would be
the code to prompt a message box "Not Valid No." when there is no find? I
can't figure out how to "catch" the fact that a number was not found.

Sub BookReturnDate()

Dim aList As Range
Dim Bcode As Variant
Bcode = Range("A1").Value
If Bcode = "" Then Exit Sub

Set aList = Range("G2:G2505")
On Error Resume Next

aList.Select
Selection.Find(What:=Bcode).Activate
ActiveCell.Offset(0, 2).Value = Now

'If no find then msgbox "Goof Up"

End Sub

Thanks for your help,
Regards,
Howard


 
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
colum is not found thats missing a column B how to find it meena Excel Worksheet Functions 1 July 17th 09 10:36 AM
FIND function does not return ZERO when text is not found DOUG01A Excel Worksheet Functions 5 August 5th 08 05:56 PM
How to find a row since I found a value in a column? see example [email protected] Excel Worksheet Functions 1 April 25th 06 05:45 PM
Find text in another workbook and paste if found match - VBA Pasmatos Excel Discussion (Misc queries) 1 November 10th 05 01:00 PM
Copy Rows found using Find All feature Scott H Excel Discussion (Misc queries) 3 May 2nd 05 06:04 PM


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

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

About Us

"It's about Microsoft Excel"