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
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