A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Help with setting a "nof found" statement



 
 
Thread Tools Display Modes
  #1  
Old April 20th, 2010, 11:16 PM posted to microsoft.public.excel.misc
Pierre
external usenet poster
 
Posts: 223
Default Help with setting a "nof found" statement

Hi.


I have the following code:

Private Sub CommandButton1_Click()
Dim myasset As Variant
Dim Assettag As Variant
Assettag = UserForm1.TextBox1.Value


If UserForm1.TextBox1.Value 0 Then

'Serial #
Set myasset = ThisWorkbook.Sheets("Full
listing").Columns("a").Find(What:=Assettag, LookAt:=xlWhole)
UserForm1.TextBox2.Value = myasset.Offset(0, 1).Value

'Product desc

Set myasset = ThisWorkbook.Sheets("Full
listing").Columns("a").Find(What:=Assettag, LookAt:=xlWhole)
UserForm1.TextBox3.Value = myasset.Offset(0, 2).Value

'City
Set myasset = ThisWorkbook.Sheets("Full
listing").Columns("a").Find(What:=Assettag, LookAt:=xlWhole)
UserForm1.TextBox4.Value = myasset.Offset(0, 3).Value


What I need is a statement that will produce a meassage box with "asset not
found" if there is no match - can anyone help?

Thanks

Pierre
  #2  
Old April 20th, 2010, 11:37 PM posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
 
Posts: 19,791
Default Help with setting a "nof found" statement

Check your previous post.

Pierre wrote:

Hi.

I have the following code:

Private Sub CommandButton1_Click()
Dim myasset As Variant
Dim Assettag As Variant
Assettag = UserForm1.TextBox1.Value

If UserForm1.TextBox1.Value 0 Then

'Serial #
Set myasset = ThisWorkbook.Sheets("Full
listing").Columns("a").Find(What:=Assettag, LookAt:=xlWhole)
UserForm1.TextBox2.Value = myasset.Offset(0, 1).Value

'Product desc

Set myasset = ThisWorkbook.Sheets("Full
listing").Columns("a").Find(What:=Assettag, LookAt:=xlWhole)
UserForm1.TextBox3.Value = myasset.Offset(0, 2).Value

'City
Set myasset = ThisWorkbook.Sheets("Full
listing").Columns("a").Find(What:=Assettag, LookAt:=xlWhole)
UserForm1.TextBox4.Value = myasset.Offset(0, 3).Value

What I need is a statement that will produce a meassage box with "asset not
found" if there is no match - can anyone help?

Thanks

Pierre


--

Dave Peterson
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:44 AM.


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