Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Vlookup VBA on dates

Hello,

I'm writing a piece of VBA code and I need to run a vlookup.

In particular, I've written the following code

fir = Application.WorksheetFunction.VLookup(period, Range("curve"), 2)

whe

- fir is a number;
- period: is a date written by a named range;
- curve: is a named range with dates on the 1st column and numbers in
the other columns.

I need to select a number (fir) for the nearest date to "period" in the
"curve" matrix.

When I run the model, it gets me the error:

Runtime error '1004' - "Unable to
get the Vlookup property of the WorksheetFunction class".

Why?

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 180
Default Vlookup VBA on dates

this error means Vlookup() failed.
to handle this error add an error handling routine such as

On error goto <lable

also change the datatype of the variable 'fir' to variant

--
Pranav Vaidya
VBA Developer
PN, MH-India


"gianni gianni" wrote:

Hello,

I'm writing a piece of VBA code and I need to run a vlookup.

In particular, I've written the following code

fir = Application.WorksheetFunction.VLookup(period, Range("curve"), 2)

whe

- fir is a number;
- period: is a date written by a named range;
- curve: is a named range with dates on the 1st column and numbers in
the other columns.

I need to select a number (fir) for the nearest date to "period" in the
"curve" matrix.

When I run the model, it gets me the error:

Runtime error '1004' - "Unable to
get the Vlookup property of the WorksheetFunction class".

Why?

*** Sent via Developersdex http://www.developersdex.com ***

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Vlookup VBA on dates

The question is, why did it fail?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Pranav Vaidya" wrote in message
...
this error means Vlookup() failed.
to handle this error add an error handling routine such as

On error goto <lable

also change the datatype of the variable 'fir' to variant

--
Pranav Vaidya
VBA Developer
PN, MH-India


"gianni gianni" wrote:

Hello,

I'm writing a piece of VBA code and I need to run a vlookup.

In particular, I've written the following code

fir = Application.WorksheetFunction.VLookup(period, Range("curve"), 2)

whe

- fir is a number;
- period: is a date written by a named range;
- curve: is a named range with dates on the 1st column and numbers in
the other columns.

I need to select a number (fir) for the nearest date to "period" in the
"curve" matrix.

When I run the model, it gets me the error:

Runtime error '1004' - "Unable to
get the Vlookup property of the WorksheetFunction class".

Why?

*** Sent via Developersdex http://www.developersdex.com ***



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
dates in VLOOKUP MBG Excel Worksheet Functions 3 January 6th 10 06:53 PM
vlookup with Dates Jack Excel Worksheet Functions 11 October 31st 08 05:15 PM
vlookup and dates! KneeDown2Up Excel Worksheet Functions 6 April 2nd 07 08:44 AM
vlookup and dates trobinson Excel Programming 4 July 25th 06 02:09 PM
dates and vlookup grapes Excel Worksheet Functions 1 February 2nd 06 09:19 PM


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