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: 1
Default Handling Dates in VLookup


Hi,

I'm having problems trying to match dates using VLookup in a Macro
any help will be much appreciated!

I have two worksheets. The first worksheet (Prices) has two columns
the first having a list of dates, and the second having correspondin
prices (numbers). The second worksheet (cleanPrices) has a set of date
(overlapping partially with the dates in the Prices spreadsheet. I wan
to match up prices for each of the dates in the cleanPrices spreadshee
based on the prices mentioned in the Prices worksheet.

To make it clear:
Price worksheet has:
Date Price
7/7/2005 100.75
7/6/2005 98.50
7/1/2005 99.00

cleanPrices has
Date Price
7/6/2005
7/1/2005
6/30/2005

I want the Price colum in cleanPrices to have 99.50, 99.00 and "#NA"

I am using the following code (or something like this),

Dim r1 As Range
Dim x As Integer

Set r1 = Worksheets("Price").Range("A2:B5")

For x = 1 to 3
Worksheets("cleanPrices").Range("B1").Offset(x, 0).Value
Application.WorksheetFunction.VLookup(Worksheets(" cleanPrices").Range("B1").Offset(x
0).Value, Worksheets("Price").Range(r1),2, False)
Next

I have tried several combinations (used DateValue and the likes, but
am always getting errors.

Thanks

--
eager_beave
-----------------------------------------------------------------------
eager_beaver's Profile: http://www.excelforum.com/member.php...fo&userid=2551
View this thread: http://www.excelforum.com/showthread.php?threadid=38956

 
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 with Dates Jack Excel Worksheet Functions 11 October 31st 08 05:15 PM
Error handling VLOOKUP. #N/A - can it be 0 to allow sumation. Richhall Excel Worksheet Functions 3 October 8th 07 12:31 PM
dates and vlookup grapes Excel Worksheet Functions 1 February 2nd 06 09:19 PM
Error handling with a handling routine ben Excel Programming 0 March 15th 05 03:01 PM
Vlookup Error handling Gareth[_3_] Excel Programming 1 August 18th 03 07:42 PM


All times are GMT +1. The time now is 04:31 AM.

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"