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

I have the following Script I use in Lotus SmartSuite 9.5.
I am switching all my Scripts to Excel 2000.
I am done except for this one below.
I am stuck in the mud on this one. I enter "date number enter", "then month
number enter"
Help Please

Thank you
************
Sub GetDate
Dim userday As Integer
Dim usermonth As Integer
Dim useryear As Integer
usermonth% = Cint(Inputbox$("Enter the Month's Number."))
userday% = Cint(Inputbox$("Enter Day Number."))
.contents = Cstr(usermonth)&"/"&Cstr(userday)&"/"&Cstr(2004)
.FormatName = "31-Dec"
.TextHorizontalAlign = $AlignCenter
End Sub
************


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Date Entry Script

Larry,

The following code may do what you want.
(Depending on the country this is being used in,
the date format may have to be changed.)

'--------------------------------------------
Sub GetUserDate()
Dim UserDate As Variant

Retry:
UserDate = InputBox(vbNewLine & "Enter the date - Month/Day/Year", _
" Larry Townsend Asks You To...", Format$(Date, " MMM/DD/YYYY "))
On Error Resume Next
UserDate = CDate(UserDate)

If Err.Number < 0 Then
UserDate = MsgBox("Your entry is not a valid date. ", _
vbRetryCancel + vbExclamation, " OOPS")
If UserDate = vbCancel Then
Exit Sub
Else
Err.Clear
GoTo Retry
End If
End If

With ActiveSheet.Range("B4")
.NumberFormat = "DD-MMM"
.HorizontalAlignment = xlHAlignCenter
.Value = UserDate
End With
End Sub

'--------------------------------------------
Regards,
Jim Cone
San Francisco, CA

"Larry Townsend" wrote in message
...
I have the following Script I use in Lotus SmartSuite 9.5.
I am switching all my Scripts to Excel 2000.
I am done except for this one below.
I am stuck in the mud on this one. I enter "date number enter", "then month
number enter"
Help Please
Thank you
************
Sub GetDate
Dim userday As Integer
Dim usermonth As Integer
Dim useryear As Integer
usermonth% = Cint(Inputbox$("Enter the Month's Number."))
userday% = Cint(Inputbox$("Enter Day Number."))
.contents = Cstr(usermonth)&"/"&Cstr(userday)&"/"&Cstr(2004)
.FormatName = "31-Dec"
.TextHorizontalAlign = $AlignCenter
End Sub



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
Excel 2002 date entry: Cannot get away from d-m-yy entry format Steve Eklund Excel Discussion (Misc queries) 3 May 11th 09 04:57 PM
DATE SCRIPT / add function col A, Nastech Excel Discussion (Misc queries) 2 September 24th 08 04:56 AM
script for date and currency formating BRustigian Excel Discussion (Misc queries) 1 August 4th 06 09:45 PM
Auto Date Script.. nastech Excel Discussion (Misc queries) 1 January 8th 06 07:38 AM
auto date script for 2 columns? have 1.. nastech Excel Discussion (Misc queries) 2 November 22nd 05 03:10 PM


All times are GMT +1. The time now is 05:38 PM.

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"