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: 7
Default VLookup function in VBA problem?

"Bill Buckner" wrote in message
...
I am perplexed by a data type problem that occurs when I use a date to

VLookup on a table. If I use a date directly from a spreadsheet via
Range("Retire_Date_Primary") the lookup performs perfectly. However if I
declare a variable As Date and the assign this worksheet range to this
variable, the lookup fails with a type mismatch.

Dim retireDate As Date
retireDate = Range("Retire_Date_Primary")
Application.VLookup(Range("Retire_Date_Primary"), Range("Pension_Table"),

21 + insurance - 1) '<= This works
Application.VLookup(retireDate , Range("Pension_Table"), 21 + insurance -

1) '<= This fails

Try declaring retireDate as type Long (or Integer) rather than type Date.


 
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
Problem with VLOOKUP function vsoler Excel Worksheet Functions 0 September 12th 09 04:06 PM
Problem with VLookUp Function Jelinek Excel Worksheet Functions 1 April 25th 06 03:04 PM
Vlookup Function Problem Parker Excel Worksheet Functions 3 January 13th 05 06:53 PM
VLookup function in VBA problem? JWolf Excel Programming 4 May 15th 04 04:18 PM
VLookup function in VBA problem? Bill Buckner Excel Programming 0 May 11th 04 07:41 PM


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