Textbox to Cell not copying as date

jacko2401

New Member
Joined
Aug 24, 2011
Messages
35
Hi

I have a column of data that contain dates. The values are DD/MM/YYYY but the cell format is set to "ddd dd mmm yy" to display the date in the required way for the entire column (e.g. 01/05/2012 becomes Tue 01 May 12).

I have a userform with a textbox that displays one of the dates in this column depending on a selection of a combobox. I have changed the format of the textbox value to be "ddd dd mmm yy". The intention is for the date to be changed in the textbox, press a command button and for that change to reflect in the worksheet. When I copy the value back, Excel takes the value as a string and copies it literally rather than as a date in the standard DD/MM/YYYY format.

Eg A cell in the date column previously had 01/05/2012 and was displayed as Tues 01 May 12 via cell formatting. Once I amended the date in the textbox and copy it to the cell via clicking on the command button, it would change the actual cell value to the formatting of "ddd dd mmm yy". So if I changed the date to Wed 02 May 12, it should copy as a date with value 02/05/2012 and display using the cell formatting as Wed 02 May 12. Instead the actual cell value reads as Wed 02 May 12.

I have tried to use CDate to convert it back to a standard date but it does not recognise the textbox value as a date. Is there a way I can change the string value that the textbox shows to a date I can use?

Steve
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Trying to think of a solution: Is there a way to convert a string in the format of "ddd dd mmm yy" to a date with format dd/mm/yyyy?
 
Upvote 0

Forum statistics

Threads
1,216,114
Messages
6,128,910
Members
449,478
Latest member
Davenil

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