+ Reply to Thread
Results 1 to 16 of 16

can you help me? I want a code that allows writing a date only

  1. #1
    Registered User
    Join Date
    10-16-2021
    Location
    egypt
    MS-Off Ver
    2016
    Posts
    75

    can you help me? I want a code that allows writing a date only

    Distinguished professors, can you help me? I want a code to implement the following. I have 60 textboxes in UseForm, from textbox 1 to 60 textboxes. I want a code that allows writing a date only on them and the date format is dd,mm.yyyy
    Last edited by saftawy1; 01-29-2023 at 12:34 PM. Reason: change the title

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: Distinguished professors, can you help me?

    Administrative Note:

    We would very much like to help you with your query, however the thread title does not really convey what your request is about. Tell us what you are trying to do, not how you think it should be done.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: can you help me? I want a code that allows writing a date only

    Quote Originally Posted by saftawy1 View Post
    Distinguished professors, can you help me? I want a code to implement the following. I have 60 textboxes in UseForm, from textbox 1 to 60 textboxes. I want a code that allows writing a date only on them and the date format is dd,mm.yyyy
    Hello.
    Are you sure that the format is: dd,mm.yyyy ('comma' first and 'period' after)?...

    I ask you because within the Egyptian Regional Configuration I did not find anything similar to that format.
    You are always very welcome if you add reputation by clicking the * (bottom left) of each message that has helped you.

  4. #4
    Registered User
    Join Date
    10-16-2021
    Location
    egypt
    MS-Off Ver
    2016
    Posts
    75

    Re: can you help me? I want a code that allows writing a date only

    sorry its dd/mm/yyyy

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: can you help me? I want a code that allows writing a date only

    You could create a custom date picker / calendar that pops up when you enter a textbox and allows the user to select the required date rather than type it in.
    You can then easily dictate what format that date shows as in the textboxes.

    Would that work?

    BSB

  6. #6
    Registered User
    Join Date
    10-16-2021
    Location
    egypt
    MS-Off Ver
    2016
    Posts
    75

    Re: can you help me? I want a code that allows writing a date only

    how can do that?

  7. #7
    Registered User
    Join Date
    10-16-2021
    Location
    egypt
    MS-Off Ver
    2016
    Posts
    75

    Re: can you help me? I want a code that allows writing a date only

    I found a code, but I don't know how to make it work automatically on textbox
    Please Login or Register  to view this content.

  8. #8
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: can you help me? I want a code that allows writing a date only

    Have a look at the attached for an example of using a date picker / calendar for this.

    BSB
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    10-16-2021
    Location
    egypt
    MS-Off Ver
    2016
    Posts
    75

    Re: can you help me? I want a code that allows writing a date only

    ty BadlySpelledBuoy its good work i will try it

  10. #10
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: can you help me? I want a code that allows writing a date only

    Hello. I show you another way to do it.

    a) Look in the VBA environment at the three objects you need to use: the 'txtBox' class module, the 'uf_Date' helper userform, and the Userform1.

    b) In the first two objects you do not have to do anything.

    c) See in the Initialize event of Userform1 (UserForm_Initialize) the only two things you have to adapt to your needs:

    d) CtrlMatrix(1 To 4) and For i = 1 To 4 where those '1 To 4' refer to the 4 textboxes that are associated with dates in the userform.
    Attached Files Attached Files

  11. #11
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: can you help me? I want a code that allows writing a date only

    Hello everyone.
    Attached a variant of what is shown in post #10.

    In this case and in the sheet 'Hoja2' you can 'double-click' on any cell and the userform 'uf_Date' will be displayed to enter dates in the cells.
    Attached Files Attached Files

  12. #12
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: can you help me? I want a code that allows writing a date only

    Spoilt for choice - another version - Class modules interact for both ID of calender keys and ID of textboxes.
    Attached Files Attached Files
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  13. #13
    Registered User
    Join Date
    10-16-2021
    Location
    egypt
    MS-Off Ver
    2016
    Posts
    75

    Re: can you help me? I want a code that allows writing a date only

    ty torachan

  14. #14
    Registered User
    Join Date
    10-16-2021
    Location
    egypt
    MS-Off Ver
    2016
    Posts
    75

    Re: can you help me? I want a code that allows writing a date only

    ty beyond Excel

  15. #15
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: can you help me? I want a code that allows writing a date only

    @BSB, thanks for the compliment & rep point - I have flashes of lucid inspiration late at night when sleep is impossible.

  16. #16
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: can you help me? I want a code that allows writing a date only

    @torachan - I have similar moments, usually at 3am where I'm rudely awoken by my brain coming up with a solution to a problem I'd been trying to solve for much of the previous day's work. Daren't go back to sleep after that through fear of forgetting it!

    Your solution above actually solves something I was trying to do, so I've scribbled it down in my little pad and it's coming to the office with me tomorrow

    BSB

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 8
    Last Post: 06-12-2015, 04:23 PM
  2. Replies: 7
    Last Post: 03-31-2013, 03:09 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1