LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Les Les is offline
external usenet poster
 
Posts: 240
Default Use number in text box to look up value in a workbook sheet

Hi all,

I would like to use the number that it typed into the textbox
"txt_PrtNumber" and then do a Vlookup in the sheet "Local Parts" to find the
part description in column 2 of that sheet.
Could i have some help please, i have used some code from Dave Pieterson But
keep getting an error.

Any help would be much appreciated...


myPartNum = Me.txt_PrtNumber.Value

If vmyComma = 0 Then
Set LookupRange =
Workbooks("Logistics_Cost_TM_Input.xls").Worksheet s("Local
Parts").Range("A2:B65536")

If myPartNum < "" Then
res = Application.VLookup(myPartNum, LookupRange, 2, 0)
If IsError(res) Then
res = Application.VLookup(CDbl(myPartNum), _

Workbooks("Logistics_Cost_TM_Input.xls").Worksheet s("Local
Parts").Range(LookupRange), 2, False)

Me.Chk_NoPrtNo.Enabled = False
Me.txt_PrtDescription.Value = "The part Derscription will be
inserted in the request"
Me.txt_PrtDescription.Enabled = False
Else
MsgBox "Description not found, please enter", vbOKOnly +
vbCritical, "ERROR - Description not found"
Me.txt_PrtDescription.Enabled = True
Me.txt_PrtDescription.Text = vbNullString
Me.Chk_NoPrtNo.Enabled = False
Exit Sub
End If
End If
Else
Me.Chk_NoPrtNo.Enabled = False
Me.txt_PrtDescription.Value = "The part Derscriptions will be
inserted in the request"
Me.txt_PrtDescription.Enabled = False
End If


--
Les
 
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
Can an Excel workbook number sheet pages sequentially? Excel Page Numbering Excel Worksheet Functions 5 October 18th 06 04:47 PM
a number is replaced by text when inserted anywhere in the sheet Marga Excel Programming 1 October 26th 05 05:34 PM
a number is replaced by text when inserted anywhere in the sheet Marga Excel Programming 1 October 26th 05 05:28 PM
a number is replaced by text when inserted anywhere in the sheet Marga Excel Worksheet Functions 1 October 25th 05 12:21 AM
Find all text instances in a sheet and add one number from each row Greg Excel Discussion (Misc queries) 1 January 31st 05 11:45 PM


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