From: Tom on
Hi,

As part of my macro, how can I make an input box (or whatever box) to
pop up and ask the user to input a date - e.g. 25/06/2097? On
clicking OK, it then goes and locate the date in the spreadsheet.
Thanks for your help.

Tom


From: Roger Govier on
Hi Tom

Jacob Skaria posted a solution to another query in the programming group
a short while ago.
It should also suit your needs
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)
--
Regards
Roger Govier

Tom wrote:
> Hi,
>
> As part of my macro, how can I make an input box (or whatever box) to
> pop up and ask the user to input a date - e.g. 25/06/2097? On
> clicking OK, it then goes and locate the date in the spreadsheet.
> Thanks for your help.
>
> Tom
>
>
From: Jacob Skaria on
Try the below


Sub Macro2()

Dim varDate As Variant, varFound As Variant

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

If IsDate(varDate) Then
Set varFound = Cells.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)


"Tom" wrote:

> Hi,
>
> As part of my macro, how can I make an input box (or whatever box) to
> pop up and ask the user to input a date - e.g. 25/06/2097? On
> clicking OK, it then goes and locate the date in the spreadsheet.
> Thanks for your help.
>
> Tom
>
>
> .
>
From: Tom on
Thanks Roger for pointing that out.

"Roger Govier" <roger(a)technology4nospamu.co.uk> wrote in message
news:4C03991E.3030803(a)technology4nospamu.co.uk...
> Hi Tom
>
> Jacob Skaria posted a solution to another query in the programming group a
> short while ago.
> It should also suit your needs
> 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)
> --
> Regards
> Roger Govier
>
> Tom wrote:
>> Hi,
>>
>> As part of my macro, how can I make an input box (or whatever box) to
>> pop up and ask the user to input a date - e.g. 25/06/2097? On
>> clicking OK, it then goes and locate the date in the spreadsheet.
>> Thanks for your help.
>>
>> Tom

From: Tom on
That does exactly what I want. Thanks a lot jacob.

"Jacob Skaria" <JacobSkaria(a)discussions.microsoft.com> wrote in message
news:B0D62954-50BF-46DA-8471-8F3D82F1806A(a)microsoft.com...
> Try the below
>
>
> Sub Macro2()
>
> Dim varDate As Variant, varFound As Variant
>
> varDate = InputBox("Enter Date to be searched")
>
> If IsDate(varDate) Then
> Set varFound = Cells.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)
>
>
> "Tom" wrote:
>
>> Hi,
>>
>> As part of my macro, how can I make an input box (or whatever box) to
>> pop up and ask the user to input a date - e.g. 25/06/2097? On
>> clicking OK, it then goes and locate the date in the spreadsheet.
>> Thanks for your help.
>>
>> Tom
>>
>>
>> .
>>