+ Reply to Thread
Results 1 to 8 of 8

Datepicker, textbox & cells date-format does not match for formula to work

  1. #1
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Datepicker, textbox & cells date-format does not match for formula to work

    Hi,
    I have userform1 ( Very small) and have 1 datepicker, Submit button & close button.

    Date from datepicker is populated to sheet1 in column A

    Column B contains formula for =TODAY() and indicates current date.

    Userform2 is opened by doubl clicking column A
    It had two textboxes ( 1- End date & 2 for current date ( both are populated from row A & B of sheet1

    There is a Label1 aswell 'Due Now'

    I am trying to achieve is that if the End date is less that current date, the Label1 is visible.

    I may also like to amend the End date in userform2 .... trouble is here as well...the date-format

    The issue may be with - formula =today() being deleted
    buran is kind to give solution for this .... but at times it I have challanges .

    And

    Date format of textbox , cells & datepicker do not match

    It is very interesting one.
    Spent a lot of time in understanding it, however it will not work.
    I really & sincerely need some help please. Sample book attached
    Kind regards
    Attached Files Attached Files

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,138

    Re: Datepicker, textbox & cells date-format does not match for formula to work

    I am trying to achieve is that if the End date is less that current date, the Label1 is visible.
    This works as described in userform. If the date is less than Col B, the label is visible. If it's greater than B, it is not.

    Also, when you copy a date to a textbox, the date becomes a string. It would be better if you compare the cells from the sheet, instead of two textboxes.

    Likewise, when you write the date back to the sheet, it will write it back as a text. (Excel converts it most of the time.) Use CDate and/or Format to convert the string to a date, to remove all doubt.

    For your date picker, define your format.
    Please Login or Register  to view this content.
    David
    (*) Reputation points appreciated.

  3. #3
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Datepicker, textbox & cells date-format does not match for formula to work

    Hi Tinbendr,
    Thanks.
    I have now placed the formula in sheets rather than in textboxes and also using suggestions by buran.
    It worked very well for one text box.
    I now want to incorporate more textboxes, but making mistake while writting it.
    Need final help for this thread.
    Code is as follows:
    Please Login or Register  to view this content.
    Well done.
    Thanks Kind regards

  4. #4
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,138

    Re: Datepicker, textbox & cells date-format does not match for formula to work

    for instance.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Datepicker, textbox & cells date-format does not match for formula to work

    Hi Tinbendr,
    Wonderful.
    With above code it will not erase formule . However it will not save any changes made.
    We are close to it now.
    I have different approach.
    Instead of getting into complex date format of DTpicker / text boxes, can we consider the following:
    In following code, can we say that 'do not copy columns K, L, M, N to respective textboxes 11, 12, 13 14 ( as these will have formule)
    Therefore no matter how many times we amend records, these columns will be untouched.
    Please Login or Register  to view this content.
    OR
    We place formule in Row 1 ( which is untouched at all times). Then amend code to copy formule from row1 of columns K,L,M,N to the affected row cells using following code
    Please Login or Register  to view this content.
    Really great encouragement by you.
    Thanks again

  6. #6
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Datepicker, textbox & cells date-format does not match for formula to work

    Here I am talking about actual worksheet columns and not about the sample file that I had attached.
    Thanks

  7. #7
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,138

    Re: Datepicker, textbox & cells date-format does not match for formula to work

    Often we strive to write the most sophisticated code so that we achieve time efficiency with our project. But if that efficiency is gained at the expense of understanding what the heck is going on , then I must defer to the latter.

    Case in point:

    Please Login or Register  to view this content.
    This code is not sophisticated, but I can understand it without much effort. And six months from now when I have to make an adjustment, I can readily change one line and not worry that a simple change will wreck the whole project.

    That being said, I will be unable to assist you without a full version of the workbook and a understanding of what you're trying to achieve.

  8. #8
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Datepicker, textbox & cells date-format does not match for formula to work

    Hi,
    I do agree with you.
    Currently the issue now has been resolved through massive efforts and your kind support.
    I will re-plan my learning strategy.
    Learning will never end though.
    Every problem will have 1 perfect solution and every perfect solution gives rise to two new challenges.
    Because perfection has no limits.
    Thanks again for your kind help and valuable time.
    Once I fully prepare my project I will indeed take your opinion before finalizing it.
    Kind regards

+ 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. Userform textbox & sheet cells date format do not match
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-28-2014, 12:56 PM
  2. Excel:How change the textbox format from text to date format?
    By inpetto in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-10-2013, 08:23 AM
  3. [SOLVED] How to leave only two digits after separator (format cells does not work for formula)
    By lamiuks in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-21-2013, 08:34 AM
  4. [SOLVED] INDEX and MATCH with Date format and Blank Cells
    By Pooger in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-16-2013, 09:22 PM
  5. Replies: 5
    Last Post: 01-06-2012, 08:00 PM

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