Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Userform button setting variable from formula | Excel Programming | |||
Userform button setting variable from formula | Excel Discussion (Misc queries) | |||
refer to a userform in a formula | Excel Programming | |||
Userform with Formula | Excel Programming | |||
Userform Formula Help Needed | Excel Programming |