Changing style format automaticly

jorispk

New Member
Joined
Dec 9, 2011
Messages
22
Dear poeple,

I'm currently working in Excell 2013 and made a VBA form with a manual input of the date (existing from day, month and year in three separate combo boxes)

Now I'm using the following code to put the day, month and year together

Code:
Worksheets("Factuur").Range("C11") = Me.CB_Day.Value & "-" & Me.CB_Month.Value & "-" & Me.CB_Year.Value
Worksheets("Factuur").Range("C11").NumberFormat = "d-m-yyyy"

As you can see I also added the number format I want. But know when I look in my cell it's says the text(for example): 04-January-2014
But I want this to be in the format 1-1-2014, as the NumberFormat above.

Now when I select the text in the cell manually and press enter the text changes to 1-1-2014 so the format does change but I still need to give a manual enter.

Could someone help me out to change this style automatically without me pressing enter haha.

Thank you very much.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,215,737
Messages
6,126,575
Members
449,318
Latest member
Son Raphon

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