From: Pierre on
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
From: Dave Peterson on
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