Basically a listbox on a userform that when row is select for edit it displays on the Textbox as text but with the date it display as number 42516 instead of date format has in the cell 12/10/2017 am using DTPicker
Kindly appreciate any idea out there as i was stuck with this for a bit
Thanks everyone
Here is the code
Kindly appreciate any idea out there as i was stuck with this for a bit
Thanks everyone
Here is the code
Code:
Private Sub cmdEdit_Click()
Dim lngCol As Long
Dim findvalue As Range
Dim cNum As Integer
Dim DataSH As Worksheet
Dim lRow As Long
Dim srNextRow&, strListBox$, i%
strListBox = ""
Sheets("Sheet1").Select
Application.ScreenUpdating = False
Set DataSH = Sheet1
If txtStu1.Value = "" Or txtStu2.Value = "" Then
MsgBox "There is not data to edit"
Exit Sub
End If
Set findvalue = DataSH.Range("A:A"). _
Find(What:=Me.txtStu1.Value, LookIn:=xlValues, LookAt:=xlWhole)
findvalue = txtStu1.Value
findvalue.Offset(0, 1) = txtStu2.Value
findvalue.Offset(0, 2) = txtStu3.Value
findvalue.Offset(0, 3) = txtStu4.Value
findvalue.Offset(0, 4) = txtStu5.Value
findvalue.Offset(0, 5) = txtStu5.Value
'findvalue.Offset(0, 6) = txtStu6.Value
findvalue.Offset(0, 6) = txtStu7.Value
findvalue.Offset(0, 7) = txtStu8.Value
findvalue.Offset(0, 8) = txtStu9.Value
findvalue.Offset(0, 9) = txtStu10.Value
findvalue.Offset(0, 10) = chLeaver.Value
findvalue.Offset(0, 11) = txtStu12.Value
Me.txtStu7.Value = Me.DTPicker1.Value.ToShortDateString
Me.txtStu8.Value = Me.DTPicker2.Value.ToShortDateString
Me.txtStu9.Value = Me.DTPicker3.Value.ToShortDateString
Me.txtStu10.Value = Me.DTPicker4.Value.ToShortDateString