SpinButton & Date Format
Bob
Thanks, That did indead work. I was getting a little frustrated with
this problem because I knew I had solved it before, but couldn't
remember how. After 4 hours and at 6am UK time I posted my message.
Having read your advice I saw what the problem was
Private Sub SpinButton1_SpinUp()
TextBox1.Text = Format(SpinButton1.Value, "dddd d mmm")
End Sub
Private Sub UserForm_Initialize()
TextBox1.Text = Format(Date + 1, "dddd d mmm")
End Sub
Thanks again
Phil
Bob Phillips wrote:
Phil,
The problem lies with the string your store in Textbox1. Although it
looks
like a date, it is just a string.
I have used a date variable to hold the date, increment that, and
display
it. like so
Dim myDate As Date
Private Sub SpinButton1_SpinUp()
myDate = myDate + 1
TextBox1.Text = Format(myDate, "dddd d mmm")
End Sub
Private Sub UserForm_Initialize()
myDate = Date + 1
TextBox1.Text = Format(myDate, "dddd d mmm")
End Sub
--
HTH
-------
Bob Phillips
wrote in message
oups.com...
I would like to use a SpinButton to change the date value held in
TextBox1. Using the follow code in the SpinUp event procedures
works
------------------------------
Private Sub SpinButton1_SpinUp()
TextBox1.Text = Format(CDate(TextBox1.Text) + 1, "dd mm yyyy")
End Sub
------------------------------
But I need to return the date in the form "Monday 21 Dec" with no
year
------------------------------
Private Sub UserForm_Initialize()
TextBox1.Text = Format(Date + 1, "dddd d mmm")
End Sub
------------------------------
I would welcome any advice
Thanks
Phil
|