Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Input box to find date
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Input box to find date
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 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Input box to find date
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 . |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Input box to find date
Thanks Roger for pointing that out.
"Roger Govier" wrote in message ... 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 |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Input box to find date
That does exactly what I want. Thanks a lot jacob.
"Jacob Skaria" wrote in message ... 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 . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
INPUT BOX FIND NAME IN COLUMN A | Excel Discussion (Misc queries) | |||
How input today's date and keep that date | Excel Worksheet Functions | |||
input a date or update it based on date in another cell | New Users to Excel | |||
Find and input value based on month | Excel Discussion (Misc queries) | |||
how to input a calculation in excel to find the geometric mean | Excel Worksheet Functions |