change User Form Labels based on combo box

raccoon588

Board Regular
Joined
Aug 5, 2016
Messages
118
I have a user form with a combo box that has a mist of dates. When the user selects the date i would like the labels to change.


EX: the user selects 6/18/2018 and the labels change to 6/18/2018, 6/19/2018, 6/20/2018 etc.
EX: the user selects 6/25/2018 and the labels change to 6/25/2018, 6/26/2018, 6/27/2018 etc.






is there some code that will make this happen?
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
maybe something like this

Code:
Private Sub ComboBox1_Change()
Label1.Caption = ComboBox1.Value
Label2.Caption = ComboBox1.Value + 1
Label3.Caption = ComboBox1.Value + 2
'and so on
End Sub
 
Upvote 0
maybe try this
Code:
Label1.Caption = Format(ComboBox1.Value, "Short Date")
'and so on

EDIT: when you say "number" what numbers were you getting? the result should be a date correct?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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