×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Spinner Button Change Value in Text Box By Formatted Date

Spinner Button Change Value in Text Box By Formatted Date

Spinner Button Change Value in Text Box By Formatted Date

(OP)
I wish to use VBA to change the value in the relevant text box in a full formatted value.

Change
Wednesday, 21 March 2018
[indent]With a spin to
Thursday, 22 March 2018

I have a spreadsheet calculation that I can use to show the day from the date but I want a single spin to be able to change the whole day/date format.

Thanks for your help.

RE: Spinner Button Change Value in Text Box By Formatted Date

Since this is a VBA question, you should be asking this question in forum707: VBA Visual Basic for Applications (Microsoft)

Anyway, try this:
Label1 and SpinButton1 controls on the Excel's UserForm:

CODE

Option Explicit
Dim dat As Date

Private Sub UserForm_Initialize()
dat = Now
Label1.Caption = Format(dat, "DDDD, DD MMMM YYYY")
End Sub

Private Sub SpinButton1_SpinDown()
Call SpinMyButton(-1)
End Sub

Private Sub SpinButton1_SpinUp()
Call SpinMyButton(1)
End Sub

Private Sub SpinMyButton(ByRef intS As Integer)
dat = DateAdd("d", intS, dat)
Label1.Caption = Format(dat, "DDDD, DD MMMM YYYY")
End Sub 


---- Andy

There is a great need for a sarcasm font.

RE: Spinner Button Change Value in Text Box By Formatted Date

(OP)
Dear Andrzejek
Thank you for your help. Sorry that I set this question in the wrong forum.
Paul

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close