JimmyTheHand
10-20-2007, 02:14 AM
How is Find method used with dates?
Range("F1:IV4") contains dates. I want to find the cell that has a value of e.g. "10.01" (1st of October).
I tried to search in values, formulas, even in comments, and tried to change the format of the value that is being sought. I tried to utilize Find in every way I could think of, but it never finds the right cell. It never finds anything! :banghead:
See the attached sample workbook for reference.
Here is one version of the code I used. Can anyone make the right adjustments? Or tell me why is it impossible?
Sub FindDate()
Dim i As Long, Rng As Range, Hit As Range
Set Rng = Sheets("Jelen").Range("F1:IV4")
For i = 9 To 12
Set Hit = Rng.Find(Range("B" & i), , xlValues, xlPart)
If Hit Is Nothing Then
Range("C" & i) = "#error"
Else
Range("C" & i) = "Hit"
End If
Next
End Sub
:help
Thanks,
Jimmy
Range("F1:IV4") contains dates. I want to find the cell that has a value of e.g. "10.01" (1st of October).
I tried to search in values, formulas, even in comments, and tried to change the format of the value that is being sought. I tried to utilize Find in every way I could think of, but it never finds the right cell. It never finds anything! :banghead:
See the attached sample workbook for reference.
Here is one version of the code I used. Can anyone make the right adjustments? Or tell me why is it impossible?
Sub FindDate()
Dim i As Long, Rng As Range, Hit As Range
Set Rng = Sheets("Jelen").Range("F1:IV4")
For i = 9 To 12
Set Hit = Rng.Find(Range("B" & i), , xlValues, xlPart)
If Hit Is Nothing Then
Range("C" & i) = "#error"
Else
Range("C" & i) = "Hit"
End If
Next
End Sub
:help
Thanks,
Jimmy