Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Vlookup still not working

I am working in Excel 97 and have the following code.

Private Sub CalcSchedule_Click()

Dim strCurrentSchedDate As Date
Dim strLookupDate As String
Dim strLookupYesNo As String

Sheets("NON WORKDAY").Select
Application.Rows("10:232").Select
Selection.Sort Key1:=Application.Range("A10"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Sheets("Schedule").Select
strCurrentSchedDate = Cells(7, 3).Value
Range("A1").Value = strCurrentSchedDate
Cells(1, 2) = Application.VLookup(strCurrentSchedDate, _
Worksheets("NON WORKDAY").Range("A10:A500"), 2)

End Sub

The problem is that vlookup is returning #N/A. In fact, the date, 01/08/2005
I am looking up, is located in cell A12 on Worksheet "NON WORKDAY". Does
anybody know what could be the problem? I have confirmed, by stepping through
the code, that strCurrentSchedDate contains 01/08/2005.
--
M. Shipp
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Vlookup still not working

Try this:

Cells(1, 2) = Application.VLookup(clng(strCurrentSchedDate), _
Worksheets("NON WORKDAY").Range("A10:A500"), 2)

--
Regards,
Tom Ogilvy




"SHIPP" wrote in message
...
I am working in Excel 97 and have the following code.

Private Sub CalcSchedule_Click()

Dim strCurrentSchedDate As Date
Dim strLookupDate As String
Dim strLookupYesNo As String

Sheets("NON WORKDAY").Select
Application.Rows("10:232").Select
Selection.Sort Key1:=Application.Range("A10"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Sheets("Schedule").Select
strCurrentSchedDate = Cells(7, 3).Value
Range("A1").Value = strCurrentSchedDate
Cells(1, 2) = Application.VLookup(strCurrentSchedDate, _
Worksheets("NON WORKDAY").Range("A10:A500"), 2)

End Sub

The problem is that vlookup is returning #N/A. In fact, the date,

01/08/2005
I am looking up, is located in cell A12 on Worksheet "NON WORKDAY". Does
anybody know what could be the problem? I have confirmed, by stepping

through
the code, that strCurrentSchedDate contains 01/08/2005.
--
M. Shipp



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Vlookup still not working

One other correction. You are trying to return data from column 2, but only
have a single column as the lookup range, so you need

Cells(1, 2) = Application.VLookup(clng(strCurrentSchedDate), _
Worksheets("NON WORKDAY").Range("A10:B500"), 2)




--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Try this:

Cells(1, 2) = Application.VLookup(clng(strCurrentSchedDate), _
Worksheets("NON WORKDAY").Range("A10:A500"), 2)

--
Regards,
Tom Ogilvy




"SHIPP" wrote in message
...
I am working in Excel 97 and have the following code.

Private Sub CalcSchedule_Click()

Dim strCurrentSchedDate As Date
Dim strLookupDate As String
Dim strLookupYesNo As String

Sheets("NON WORKDAY").Select
Application.Rows("10:232").Select
Selection.Sort Key1:=Application.Range("A10"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Sheets("Schedule").Select
strCurrentSchedDate = Cells(7, 3).Value
Range("A1").Value = strCurrentSchedDate
Cells(1, 2) = Application.VLookup(strCurrentSchedDate, _
Worksheets("NON WORKDAY").Range("A10:A500"), 2)

End Sub

The problem is that vlookup is returning #N/A. In fact, the date,

01/08/2005
I am looking up, is located in cell A12 on Worksheet "NON WORKDAY". Does
anybody know what could be the problem? I have confirmed, by stepping

through
the code, that strCurrentSchedDate contains 01/08/2005.
--
M. Shipp





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
If (Vlookup 0) working, but what if Vlookup cell does not exist Steve Excel Worksheet Functions 18 November 18th 09 07:33 PM
VLOOKUP not working Teri Excel Discussion (Misc queries) 1 May 25th 08 06:16 PM
VLookup not working Scott Excel Worksheet Functions 2 January 29th 08 03:13 PM
Vlookup not working for me. Tbram Excel Worksheet Functions 1 May 8th 07 05:14 PM
VLOOKUP not working Scott Excel Worksheet Functions 3 November 12th 04 08:06 PM


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