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: 8
Default Problem with lookups via VBA

I'm trying to use the Find method to look up values in tables according to
the date. The first column holds the date, and columns b - j hold the
numerical data. All columns and rows are in the named range "Data". Here's
the code I've written -

Sub Lookup()
Dim vResult As Variant

datein = InputBox("Enter Target Date")
If datein 0 Then
datein = DateValue(datein)
End If
MsgBox "Date = " & datein

If WorksheetFunction.CountIf(Sheet1.Range("Data"), datein) 0 Then
With Sheet1.Range("Data")
vResult = .Find(What:=(datein), After:=.Cells(1, 1),
SearchOrder:=xlByRows, SearchDirection:=xlNext).Offset(0, 2)
End With
MsgBox vResult
End If
End Sub

The error tells is 91: Object or with variable not set - I have read that
this may not have to do with the variables, but on mouseover, the variable
vResult is empty. Any help would be appreciated.


 
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
Lookups Warren Easton Excel Discussion (Misc queries) 2 July 9th 08 03:38 PM
Problem understanding dependant lookups [email protected] Excel Worksheet Functions 9 June 19th 06 12:12 PM
Lookups nick Excel Worksheet Functions 0 October 3rd 05 06:37 PM
LOOKUPS - Creating LOOKUPs where two different values must BOTH be satisfied. Mr Wiffy Excel Worksheet Functions 2 May 16th 05 04:29 AM
Lookups.. BWGames Excel Programming 2 January 10th 04 03:38 PM


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