How To Get A Date To Advance In A TextBox

  • Thread starter Thread starter Minitman
  • Start date Start date
M

Minitman

Greetings,

I have a TextBox that needs to display in a date format and a
CommandButton that needs to advance this date by 1 day every time it
is clicked.

The first question is how to get TextBox1 to display a date format
(mmm/dd/yyyy)?

The second question is how to advance this date with a CommandButton
(the button is called NextDateButton)?

Any help would be appreciated.

TIA

-Minitman
 
You have not said were the text box is on a sheet or a dilaog box


for a sheet

this gives todays date
Sheets(1).TextBox1.Text = Format(Now(), "dd/mm/yyyy")

this adds 1 to the date in the text box
Sheets(1).TextBox1.Text = Format(DateValue(Sheets(1). _
TextBox1.Text) + 1, "dd/mm/yyyy"
 
Sorry, this TextBox is on a UserForm.

I modified your code thus:

TextBox1.Text = Format(DateValue(TextBox1.Text) + 1, "mmm/dd/yyyy")

And placed it in the code of the "Next" button.

It works very well.

Thank you.

-Minitman
 
Back
Top