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: 113
Default Lookup Function in user form

I have a combo box (cboitem1) and a text box (txtprice1). I am using the code
below to have txtprice1 fill with the corresponding price the worksheet:

Private Sub Cboitem1_Change()
If cboItem1 < "" Then
txtprice1.Value = Excel.WorksheetFunction.VLookup(cboItem1.Value,
Sheets("Pizzas").Range("A1:B65536"), 2, False)
End If
End Sub

It works perfectly when you enter an existing value in cboitem1. However if
'the user' accidently types a letter that is not the first letter of one of
the existing items VB debugging pops up with error "Unable to get the Vlookup
property..."

I am assuming this is because the Vlookup function is giving afalse value.
How can I get it to not revert to the debugging and just give an error
message?

Thanks in advance!
R
 
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
Date field in user form & Loading a user form on opening workbook Balan Excel Programming 1 May 24th 08 03:40 PM
Creating Lookup User Form Please Help Excel Programming 3 January 6th 08 12:16 AM
Recall function to a User Form shnim1 Excel Discussion (Misc queries) 1 April 12th 06 07:47 AM
calling a function in a worksheet from a user form steve Excel Programming 1 January 19th 06 10:00 PM
Looking to create a simple user form with lookup Tim Excel Discussion (Misc queries) 5 November 14th 05 04:57 PM


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

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"