Hi board,
Can you tell me why this code can not look up dates. I've got a date in A1 and dates in A:B (Column A). It would be very much appreciated....thanxs
Sub Example_of_Vlookup()
Dim lookFor As Range
Dim rng As Range
Dim col As Integer
Dim found As Variant
Set lookFor = Sheets("Sheet1").Range("A1")
Set rng = Sheets("b").Columns("A:B")
col = 2
On Error Resume Next
found = Application.VLookup(lookFor.Value, rng, col, 0)
If IsError(found) Then
MsgBox lookFor & " not found"
Else: MsgBox "The look-up value of " & lookFor & " is " & found & " in column " & col
End If
On Error GoTo 0
End Sub
Can you tell me why this code can not look up dates. I've got a date in A1 and dates in A:B (Column A). It would be very much appreciated....thanxs
Sub Example_of_Vlookup()
Dim lookFor As Range
Dim rng As Range
Dim col As Integer
Dim found As Variant
Set lookFor = Sheets("Sheet1").Range("A1")
Set rng = Sheets("b").Columns("A:B")
col = 2
On Error Resume Next
found = Application.VLookup(lookFor.Value, rng, col, 0)
If IsError(found) Then
MsgBox lookFor & " not found"
Else: MsgBox "The look-up value of " & lookFor & " is " & found & " in column " & col
End If
On Error GoTo 0
End Sub