davedave24
Programmer
Hi, how can I make a spinbutton alter a TextBox with the date format "ddd dd-mmm yy" (Tue 19-Feb 13).
I can make it work for just the date (and another textbo for the time works fine), but how would I add the day of week into it?
I can make it work for just the date (and another textbo for the time works fine), but how would I add the day of week into it?
Code:
Private Sub UserForm_Initialize()
txtDate.Text = Format(Date, "dd-mmm yy")
txtTime.Text = Format(Time, "hh:00")
End Sub
Private Sub spnDate_SpinDown()
txtDate = Format(DateAdd("d", -1, txtDate), "dd-mmm yy")
End Sub
Private Sub spnDate_SpinUp()
txtDate = Format(DateAdd("d", 1, txtDate), "dd-mmm yy")
End Sub
Private Sub spnTime_SpinDown()
txtTime.Value = Format(TimeValue(txtTime.Text) - TimeSerial(0, 30, 0), "hh:mm")
End Sub
Private Sub spnTime_SpinUp()
txtTime.Value = Format(TimeValue(txtTime.Text) + TimeSerial(0, 30, 0), "hh:mm")
End Sub