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: 411
Default What is the right syntax for vlookup in vba?

Hi,

Using Excel 2000, the code is returning an error--"runtime error. Type
mismatch" on this line:

Me.txt1.Text = Application.Evaluate("=VLookup(" & sCoreAdapShell & ",
tblPriceListCorePart, 5,False)")

I'm looking for feedback about the syntax for using vlookup in vba.

The above line is in the commandbutton--cmdCalc with the following
code:

Private Sub cmdCalc_Click()
Dim sCoreAdapShell As Variant
sCoreAdapShell = txtCore.Text & txtAdap_Config.Text & txtShell.Text
Me.txt1.Text = Application.Evaluate("=VLookup(" & sCoreAdapShell & ",
tblPriceListCore, 5,False)")
End Sub

For my lookup value, I'm using the variable--sCoreAdapShell. that
concatinates the data in three textboxes. txtCore and txtAdap_Config
are populated when I select a choice from a combobox. txtShell is
populated by the user.

For the table array, I'm using the named range--tblPriceListCore.

Thanks,

Dan

More details:

I have the following objects and code:
a userform--userform4

a combobox--cboFormula with the following code.

Private Sub cboFormula_Change()
'George Clark
'Newsgroups: microsoft.public.Excel.programming
'From: George Clark
'Date: Sun, 21 Jan 2001 19:36:37 -0500
'Subject: How can I populate a TextBox control in xl 2000

'Put the core part, multiplier and adapter configuration in textboxes
'for use in the vlookup to get the price
With cboFormula
txtCore = .Column(1, .ListIndex) ' Core Part
txtCore_Multiplier = .Column(2, .ListIndex) ' Multiplier
txtAdap_Config = .Column(3, .ListIndex) ' Adapter
configuration
End With
End Sub

 
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
Vlookup syntax format Yossi evenzur[_2_] Excel Programming 13 January 25th 08 07:51 PM
VLookUp Syntax Error ? u473 Excel Programming 3 November 24th 07 01:55 AM
application.vlookup syntax [email protected] Excel Programming 1 November 30th 06 02:59 AM
Vlookup syntax SueJB Excel Programming 7 September 14th 05 05:18 PM
Vlookup Syntax Error YV New Users to Excel 9 December 23rd 04 05:28 PM


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