Thread: inputbox
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
J.E. McGimpsey J.E. McGimpsey is offline
external usenet poster
 
Posts: 493
Default inputbox

one way:

Dim result As Variant
Do
result = Application.InputBox("Enter date:", Type:=2)
If result = False Then Exit Sub 'User clicked Cancel
Loop Until IsDate(result)
result = CDate(result)


In article ,
"defj" wrote:

How would I get an inputbox variable to be returned as a
date? I want the user to input a date...the date is then
compared with a list of other dates until the program
finds a date greater than the one entered. The inputbox
returns a string so it won't compare the variable with the
list of dates. Is there a way to convert a string to a
date?