Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 49
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 376
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 13
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 13
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
INPUT BOX FIND NAME IN COLUMN A Donald E Excel Discussion (Misc queries) 0 September 29th 08 05:56 PM
How input today's date and keep that date tjsmags Excel Worksheet Functions 3 December 30th 07 10:17 PM
input a date or update it based on date in another cell Doug P New Users to Excel 1 July 18th 07 11:25 PM
Find and input value based on month Django Excel Discussion (Misc queries) 2 March 2nd 06 09:17 PM
how to input a calculation in excel to find the geometric mean student1 Excel Worksheet Functions 3 July 7th 05 02:21 PM


All times are GMT +1. The time now is 01:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"