UserForm

vwsteven

New Member
Joined
Feb 14, 2011
Messages
13
Hello all,

I'm writing a code for a UserForm in Excel VBA.
What I want to do is when I type a date in one of the fields, the date -2 days appears in another text box.

is that possible or can you only input data in these fields?

thanks for any help
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Do you mean if you type a date into TextBox1 on the form that TextBox2 will show that date minus 2 days? If so, the following should work for you.

Code:
Private Sub TextBox1_AfterUpdate()
    TextBox2.Text = CDate(TextBox1.Text) - 2
End Sub
 
Upvote 0
I tested it on a user form that has 2 text boxes and it works just fine for me. What error(s) are you getting? Are you using 2 text boxes on a user form?
 
Upvote 0
hey

i'm not actually getting an error or anything
it just doesn't seem to work. I have two columns of text boxes and I want to enter the dates in the one and then see them in the other. but if they are in a weekend for example, I have to be able to amend them manually.

thanks for your help
 
Upvote 0

Forum statistics

Threads
1,224,504
Messages
6,179,144
Members
452,891
Latest member
JUSTOUTOFMYREACH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top