Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Type Mismatch in Vlookup?

Hello,
Trying to use result of a "Set" statement as part of
array in a VLookup. Set statement returns the correct
value, but I get a 'type mismatch' error in the VLookup.
See below. Why doesn't this work and how do I fix?
Thx!,LJ
PS:sorry for long text below; it's the only way I can
keep it straight.
----------------------

Sub GetStrategy()

'Sets # of loops based on # of data items--works OK
For x = 1 To Range("Data_NumStrategy")
Range("Data_DebtIndex").Value = x

'Sets Loan as the name of each data item--works OK
Dim Loan As Object
Set Loan = Application.WorksheetFunction.Index(Range
("Data_SheetListCopy"), x, 1)

'Set Value of "Analysis_Balance" by looking up the
'corresponding value on Sheet(Loan), where Loan is
'the name returned in the step above--this gives me
'the Type Mismatch error.
Range("Analysis_Balance").Value =
Application.WorksheetFunction.VLookup("Analysis_Da te",
Sheets(Loan).Range("A1:G500"), 3, False)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Type Mismatch in Vlookup?

Hi
Variable Loan is probably the cause since you define it as Object and
Sheets() expects a string in your VLookup formula.
So I would suggest you amend with:
Dim Loan

HTH
Cordially
Pascal

"LJones" a écrit dans le message de
...
Hello,
Trying to use result of a "Set" statement as part of
array in a VLookup. Set statement returns the correct
value, but I get a 'type mismatch' error in the VLookup.
See below. Why doesn't this work and how do I fix?
Thx!,LJ
PS:sorry for long text below; it's the only way I can
keep it straight.
----------------------

Sub GetStrategy()

'Sets # of loops based on # of data items--works OK
For x = 1 To Range("Data_NumStrategy")
Range("Data_DebtIndex").Value = x

'Sets Loan as the name of each data item--works OK
Dim Loan As Object
Set Loan = Application.WorksheetFunction.Index(Range
("Data_SheetListCopy"), x, 1)

'Set Value of "Analysis_Balance" by looking up the
'corresponding value on Sheet(Loan), where Loan is
'the name returned in the step above--this gives me
'the Type Mismatch error.
Range("Analysis_Balance").Value =
Application.WorksheetFunction.VLookup("Analysis_Da te",
Sheets(Loan).Range("A1:G500"), 3, False)



Reply
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
Type mismatch... George[_4_] Excel Discussion (Misc queries) 7 December 19th 07 12:20 PM
Type Mismatch [email protected] Excel Worksheet Functions 1 May 16th 07 03:29 PM
type mismatch--how to fix rroach Excel Discussion (Misc queries) 2 July 14th 05 06:23 PM
Type mismatch Stuart[_5_] Excel Programming 4 February 19th 04 07:54 PM
Type Mismatch Phil Hageman[_3_] Excel Programming 2 January 9th 04 06:11 PM


All times are GMT +1. The time now is 12:23 AM.

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"