#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default inputbox

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?
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default inputbox

y = inputbox("enter date","Date")
x=1
do until y < worksheets("").cells(x,2) list of dates
x=x+1
loop

the error I'm getting is that x is "overflowed" (because
it doesn't find a date greater than the one entered)
Though when I look at the list, there are dates greater
than the one entered.

-----Original Message-----
More details on YOUR string

--
Don Guillett
SalesAid Software

"defj" wrote in

message
...
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?



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
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?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default inputbox

works like a charm-

thnx

-----Original Message-----
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?

.

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
InputBox with VBA Mark[_8_] Excel Discussion (Misc queries) 0 November 24th 08 12:39 AM
InputBox peyman Excel Discussion (Misc queries) 4 September 28th 07 04:53 PM
InputBox GeorgeJ Excel Discussion (Misc queries) 5 July 12th 07 01:20 AM
inputbox brownti via OfficeKB.com Excel Discussion (Misc queries) 2 February 9th 07 02:37 PM
Inputbox with VBA Jeff Excel Discussion (Misc queries) 3 January 19th 06 05:18 PM


All times are GMT +1. The time now is 10:10 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"