View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Help - Need a Macro/Popup to Find a Date in a Sheet.

Try this version..

Sub Macro2()

Dim varDate As Variant, varFound As Variant

varDate = InputBox("Enter Date to be searched")

If IsDate(varDate) Then
Set varFound = Columns(1).Find(CDate(varDate), _
LookIn:=xlValues, Lookat:=xlWhole)
If Not varFound Is Nothing Then
varFound.Activate
Else
MsgBox "Date not found"
End If
Else
MsgBox "Invalid Date"
End If
End Sub

--
Jacob (MVP - Excel)


"Kev - Radio Man" wrote:

Sub Macro2()
Dim varDate As Variant, varFound As Variant

varDate = InputBox("Enter Date to be searched")

If IsDate(varDate) Then
Set varFound = Columns(1).Find(varDate, LookIn:=xlValues, Lookat:=xlWhole)
If Not varFound Is Nothing Then
varFound.Activate
Else
MsgBox "Date not found"
End If
Else
MsgBox "Invalid Date"
End If
End Sub

Jacob,

Thanks for that, it does work, but my mistake, I meant to say that when the
date is entered it goes to that date (row) in that sheet if found, else
produce an error message.
Your code does do as it asks, says "Yes" the date exsists.

Sorry for my mis-explaination of what I was trying to do. Your help is most
grateful.

Kevin.