Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default KeyDown in TextBox to increment Number


This procedure for a textbox increments time by 15 minutes. I want to
change it so that
the content is a simple number in format "#0.00" and the KeyDown
increments the number by 0.25

Private Sub txtStartTime_KeyDown(ByVal KeyCode _
As MSForms.ReturnInteger, _
ByVal Shift As Integer)

Dim sDate As String
Dim v As Integer
dte As Date

Select Case KeyCode
Case 37 ' Left
v = -1
Case 39 ' Right
v = 1
Case Else
v = 0
End Select
sDate = txtStartTime.Text

If IsDate(sDate) And v < 0 Then
dte = CDate(sDate)
dte = dte + v * TimeValue("00:15")
txtStartTime = Format(dte, "h:mm AM/PM")
End If
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
Increment number on command Bernie Deitrick Excel Programming 4 January 9th 07 04:36 AM
Increment number on command Tom Ogilvy Excel Programming 0 January 9th 07 12:58 AM
Textbox Keydown event not triggered. droopy928gt[_15_] Excel Programming 0 May 8th 06 02:52 PM
increment number by code nowfal[_22_] Excel Programming 0 July 22nd 05 08:12 PM
Increment number by 1 Joe Derr Excel Programming 5 May 16th 04 08:28 PM


All times are GMT +1. The time now is 06:44 AM.

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

About Us

"It's about Microsoft Excel"