Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Hi
I Run WinXP with Excel 2K I have created a form to enter data into a worksheet. This works fine. The first entry in the form is a date. Normally in Excel when I type a date I just enter the day followed by a backslash followed by the month (23/9) and enter and it returns 23/09/2009. However, when I type into the first text box of the form 23/9 it just stays like that. I assume that this is because it is a text box and is not formatted as a date format. What I would like is for the user to be able to enter 23/9 into the first box and it display 23/9/2009. I dont even know if this is possible but I am hoping someone can supply me with some code that will do this. This is my current code for the form: Private Sub cmdAdd_Click() Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("DATA") 'find first empty row in database iRow = ws.Cells(Rows.Count, 1) _ .End(xlUp).Offset(1, 0).Row 'check for a part number If Trim(Me.TxtDate.Value) = "" Then Me.TxtDate.SetFocus MsgBox "Please enter a the date" Exit Sub End If 'copy the data to the database ws.Cells(iRow, 1).Value = Me.TxtDate.Value ws.Cells(iRow, 2).Value = Me.TxtWeek.Value ws.Cells(iRow, 3).Value = Me.TxtShift.Value ws.Cells(iRow, 4).Value = Me.TxtCrew.Value ws.Cells(iRow, 5).Value = Me.TxtNonProdDel.Value ws.Cells(iRow, 6).Value = Me.TxtCalShift.Value ws.Cells(iRow, 7).Value = Me.TxtInput.Value ws.Cells(iRow, 8).Value = Me.TxtOutput.Value ws.Cells(iRow, 9).Value = Me.TxtDelays.Value ws.Cells(iRow, 10).Value = Me.TxtCoils.Value ws.Cells(iRow, 11).Value = Me.TxtThrd.Value ws.Cells(iRow, 12).Value = Me.TxtEps.Value ws.Cells(iRow, 13).Value = Me.TxtType.Value ws.Cells(iRow, 14).Value = Me.TxtNpft.Value ws.Cells(iRow, 15).Value = Me.TxtScrp.Value ws.Cells(iRow, 16).Value = Me.TxtDwnGrd.Value ws.Cells(iRow, 17).Value = Me.TxtRawCoil.Value ws.Cells(iRow, 18).Value = Me.TxtInj.Value ws.Cells(iRow, 19).Value = Me.TxtSlowRun.Value ws.Cells(iRow, 20).Value = Me.TxtPlanOutput.Value ws.Cells(iRow, 21).Value = Me.TxtBudgOutput.Value 'clear the data Me.TxtDate.Value = "" Me.TxtWeek.Value = "" Me.TxtShift.Value = "" Me.TxtCrew.Value = "" Me.TxtNonProdDel.Value = "" Me.TxtCalShift.Value = "" Me.TxtInput.Value = "" Me.TxtOutput.Value = "" Me.TxtDelays.Value = "" Me.TxtCoils.Value = "" Me.TxtThrd.Value = "" Me.TxtEps.Value = "" Me.TxtType.Value = "" Me.TxtNpft.Value = "" Me.TxtScrp.Value = "" Me.TxtDwnGrd.Value = "" Me.TxtRawCoil.Value = "" Me.TxtInj.Value = "" Me.TxtSlowRun.Value = "" Me.TxtPlanOutput.Value = "" Me.TxtBudgOutput.Value = "" Me.TxtDate.SetFocus End Sub ------------------------------------------------------------------------ Private Sub cmdClose_Click() Unload Me End Sub --------------------------------------------------------------------------- Private Sub UserForm_QueryClose(Cancel As Integer, _ CloseMode As Integer) If CloseMode = vbFormControlMenu Then Cancel = True MsgBox "Please use the button!" End If End Sub Thanks John |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Function or Code Needed | Excel Worksheet Functions | |||
Help needed with VBA code | Excel Discussion (Misc queries) | |||
VBA code help needed | Excel Discussion (Misc queries) | |||
VLOOKUP code needed please | Excel Worksheet Functions | |||
VBA code to sum a row: syntax needed | Excel Discussion (Misc queries) |