View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Melanie Breden Melanie Breden is offline
external usenet poster
 
Posts: 88
Default Find date in another workbook

I need to find a date in Production Calendar.xls from Production Job
List.xls. So far this is what I've got:

Workbooks("Production
Calendar.xls").Worksheets("Phoenix").Range("A:G"). Cells
Find(What:="9/24/2004", LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False).Activate

message = CStr(ActiveCell.Location)


On the find statement I get an "Invalid or unqualified reference"
error.

Actually, in the calendar itself the date is in format "24-Sep", not
sure if that matters or not since it's a date.


try this:

Sub FindDate()
Dim rngDate As Range

On Error Resume Next
Set rngDate = Workbooks("Production Calendar.xls").Worksheets("Phoenix") _
.Range("A:G").Cells.Find(#9/24/2004#)

If Not rngDate Is Nothing Then
MsgBox rngDate.Address
Else
MsgBox "Date not found"
End If
End Sub

--
Regards
Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)