LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default userform and formula

I'm new at this, but I'v managed to cobble this together. when a user enters
a time into textbox1 they enter it as 1300 (1:00 PM), or 0800 (8:00 AM). I
need it to be changed from 1300 to 13:00 and entered into cell C5. I can't
seem to get it to work.

Any Help would be greatly appreciated.

Thanks, in advance

Private Sub CommandButton1_Click()

Dim Stime As String
Dim Etime As String
Stime = Find(Mid(TextBox1.Text, 1, 2) & ":" & Mid(TextBox1.Text, 3, 2))
Etime = .Find(Mid(TextBox2.Text, 1, 2) & ":" & Mid(TextBox2.Text, 3, 2))

With Worksheets("sheet1")
If TextBox3.Text < "" Then
Range("A3").Select
Application.Selection.Value = TextBox3.Text
Cancel = False
Else: MsgBox "Please enter your name in the box."
End If

If TextBox4.Text < "" Then
Range("A7").Select
Application.Selection.Value = TextBox4.Text
Cancel = False
Else: MsgBox "Please enter the name of the officer who will relieve
you"
End If

If TextBox5.Text < "" Then
Range("A9").Select
Application.Selection.Value = TextBox5.Text
Cancel = False
Else: MsgBox "Please enter the name of the officer you relieved"
End If

If TextBox1.Text < "" Then
Range("C5").Select
Application.Selection.Value = Stime
Cancel = False
End With
Else: MsgBox "Please enter the time your shift starts"
End If

If TextBox2.Text < "" Then
Range("D5").Select
Application.Selection.Value = TextBox2.Text
Cancel = False
Else: MsgBox "Please enter the time your shift ends"
End If

End With
TextBox1.Text = Clear
TextBox2.Text = Clear
TextBox3.Text = Clear
TextBox4.Text = Clear
TextBox5.Text = Clear
UserForm1.Hide
End Sub
 
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
Userform button setting variable from formula teepee[_4_] Excel Programming 2 January 4th 06 06:59 PM
Userform button setting variable from formula teepee Excel Discussion (Misc queries) 0 January 3rd 06 08:26 PM
refer to a userform in a formula TimT Excel Programming 7 July 9th 05 12:05 AM
Userform with Formula Curare[_5_] Excel Programming 0 August 16th 04 01:33 AM
Userform Formula Help Needed timh2ofall Excel Programming 2 December 12th 03 10:55 PM


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