Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default SpinButton & Date Format

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default SpinButton & Date Format

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default SpinButton & Date Format

I see. Should you not also initialise the spinbutton value to today's date +
1 (it is only a number after all.

--
HTH

-------

Bob Phillips
wrote in message
oups.com...
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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default SpinButton & Date Format

Hi Bob,

I am a little surprised but it would seem that setting the
SpinButton's Max and Min properties has initialised the control for
me. If I REM out these two values clicking SpinDown sets the TextBox
to Saturday 30 December (from which point if will not move further
down) SpinUp is free to move until the TextBox displays Saturday 9
April

Private Sub SpinButton1_SpinDown()
TextBox1.Text = Format(SpinButton1.Value, "dddd d mmm")
End Sub

Private Sub SpinButton1_SpinUp()
TextBox 1.Text = Format(SpinButton1.Value, "dddd d mmm")
End Sub

Private Sub UserForm_Initialize()
With SpinButton1
..Enabled = True
..Max = Date + 7
..Min = Date
End With
End Sub

Bob Phillips wrote:
I see. Should you not also initialise the spinbutton value to today's

date +
1 (it is only a number after all.

--
HTH

-------

Bob Phillips
wrote in message
oups.com...
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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default SpinButton & Date Format

Private Sub UserForm_Initialize()
With SpinButton1
..Enabled = True
..Max = Date + 7
..Min = Date
..Value = Date + 1
End With
End Sub

--
Regards,
Tom Ogilvy

wrote in message
oups.com...
Hi Bob,

I am a little surprised but it would seem that setting the
SpinButton's Max and Min properties has initialised the control for
me. If I REM out these two values clicking SpinDown sets the TextBox
to Saturday 30 December (from which point if will not move further
down) SpinUp is free to move until the TextBox displays Saturday 9
April

Private Sub SpinButton1_SpinDown()
TextBox1.Text = Format(SpinButton1.Value, "dddd d mmm")
End Sub

Private Sub SpinButton1_SpinUp()
TextBox 1.Text = Format(SpinButton1.Value, "dddd d mmm")
End Sub

Private Sub UserForm_Initialize()
With SpinButton1
.Enabled = True
.Max = Date + 7
.Min = Date
End With
End Sub

Bob Phillips wrote:
I see. Should you not also initialise the spinbutton value to today's

date +
1 (it is only a number after all.

--
HTH

-------

Bob Phillips
wrote in message
oups.com...
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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Spinbutton pcor New Users to Excel 2 November 6th 07 03:16 PM
Spinbutton Ben B Excel Discussion (Misc queries) 3 March 9th 06 11:38 AM
spinbutton? CG Rosén Excel Programming 1 November 29th 04 11:16 PM
Using Spinbutton to change a date Gheezer Excel Programming 3 January 31st 04 10:03 AM
Change a date in text format xx.xx.20xx to a recognised date format concatenator Excel Programming 1 November 24th 03 11:33 PM


All times are GMT +1. The time now is 05:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"