• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Change textbox format for date

YasserKhalil

Well-Known Member
Hello everyone
In my attachment I have userform2 which shows date in textbox1 as "yyyy/mm/dd" and it works as expected ..

My problem is with Userform1 which creates textboxes controls ..and as for date control I tried to do the same to get my format "yyyy/mm/dd" but it doesn't do it
I commented out my try ..
Here's the sample workbook
 

Attachments

myTxt is a control and doesn't have a Text or Value property
It's source is 'Data'!$D$2 or column D

Code:
? mytxt.ControlSource
'Data'!$D$2

So I would just change the Custom Number format of Column D
It will flow through to the control

Did you ever consider using a List Box instead of individual controls ?

There is also something strange happening when you try and impose a Custom Number format on Column D as YY MMM dd gets shown as mm yy d ?
 
Thanks a lot Mr. Hui for reply
I changed the custom number format of column D but it doesn't solve the problem

I know listbox can be used instead but I need to edit the existing code..

How can I change the control source for column D (I tried to make custom format in comments when I = 4 which is D but failed too)
And ideas?!
 
Thank you very much for this great modification .. That's solved the problem
Best Regards Mr. Narayan and many thanks for Mr. Hui for sharing us our issues
 
Back
Top