View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Howard Howard is offline
external usenet poster
 
Posts: 536
Default Find the correct sheet then find a value on that sheet


Dim FindDate As Double
and then:
Set RngD = .Find(CDate(FindDate), LookIn:=xlValues)


Still getting message box No Date Found.

Here is what I'm running, I may have messed something else up.
Verified the dates match with formula =A1=Sheet1!D8 again and it returns TRUE.

Howard


Sub SearchAOneClaus()
Dim FindDate As Double
Dim FindStore As String
Dim RngD As Range
Dim RngS As Range
Dim ws As Worksheet
Dim cnt As Integer

Dim LRow As Long
FindStore = Sheets("Sheet1").Range("D4").Value
FindDate = Sheets("Sheet1").Range("D8")

If FindDate 0 Then
For Each ws In ThisWorkbook.Worksheets
With ws.Range("A1")
Set RngD = .Find(CDate(FindDate), LookIn:=xlValues)

If Not RngD Is Nothing Then
Application.Goto RngD

Exit For

End If
End With
Next ws

End If

If Not RngD Is Nothing Then

With ActiveSheet
LRow = .Cells(.Rows.Count, 3).End(xlUp).Row
Set RngS = .Range("C5:C" & LRow).Find(FindStore, _
LookIn:=xlValues)
If Not RngS Is Nothing Then
RngS.Select
Else
MsgBox "No value for FindStore"
End If
End With
Else
MsgBox "No date found"
End If
End Sub