Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Date from InputBox

I need to include in my macro a user defined date field,
i.e show all invoices before a certain date. I have tried
this with Myvalue = InputBox("Enter a date") but this
returns a value not a date when added to a cell in the
worksheet.

Any help would be greatly appreciated.

Thanks
Michael
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Date from InputBox

Hi Michael,

Try something like:

myValue = InputBox("Enter a date")
Range("A1").Value = Format(myValue, ("mm/dd/yy"))

---
Regards,
Norman


"Michael" wrote in message
...
I need to include in my macro a user defined date field,
i.e show all invoices before a certain date. I have tried
this with Myvalue = InputBox("Enter a date") but this
returns a value not a date when added to a cell in the
worksheet.

Any help would be greatly appreciated.

Thanks
Michael



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Date from InputBox

Thanks very much, so obvious when you know how.

THANKS again
Michael
-----Original Message-----
Hi Michael,

Try something like:

myValue = InputBox("Enter a date")
Range("A1").Value = Format(myValue, ("mm/dd/yy"))

---
Regards,
Norman


"Michael" wrote in

message
...
I need to include in my macro a user defined date field,
i.e show all invoices before a certain date. I have

tried
this with Myvalue = InputBox("Enter a date") but this
returns a value not a date when added to a cell in the
worksheet.

Any help would be greatly appreciated.

Thanks
Michael



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Date from InputBox

3 things:
1: Give a date format example in your Prompt: "Enter Date: ex.( 01/02/2001)
2: Do a test: If Not IsDate(MyValue) then Msgbox " Invalid Date Given
and prompt the user to do whatever calls the Inputbox again, or recall InputBo

3: Convert uers value to a date: MyRng.Calue = CvDate(MyValue)
----- Michael wrote: ----

I need to include in my macro a user defined date field,
i.e show all invoices before a certain date. I have tried
this with Myvalue = InputBox("Enter a date") but this
returns a value not a date when added to a cell in the
worksheet.

Any help would be greatly appreciated

Thank
Michae

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 peyman Excel Discussion (Misc queries) 4 September 28th 07 04:53 PM
Inputbox with VBA Jeff Excel Discussion (Misc queries) 3 January 19th 06 05:18 PM
InputBox Hargrove Excel Programming 2 April 29th 04 07:43 PM
Inputbox sadik Excel Programming 3 February 19th 04 07:14 PM
inputbox defj Excel Programming 4 November 26th 03 10:25 PM


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