+ Reply to Thread
Results 1 to 8 of 8

VBA Userform: Check Checkbox when date Textboxes are filled in

  1. #1
    Registered User
    Join Date
    09-06-2018
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2016
    Posts
    21

    VBA Userform: Check Checkbox when date Textboxes are filled in

    I am seeking to work out the code in a complex VBA UserForm for automatically checking a checkbox (CBConsent) when the related date textboxes (named TxtConstFmRcvd and TxtconsentDA) are filled in. If a date field is deleted, the checkbox should uncheck. The checkbox must also be checkable even if no date is provided (or force a warning to complete the date fields).

    Thanks,
    ProfXer

  2. #2
    Forum Guru
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    7,952

    Re: VBA Userform: Check Checkbox when date Textboxes are filled in

    Your Chosen names play havoc with my version of excel. So you will have to change my names.

    Try this code:-

    Please Login or Register  to view this content.
    Please Avoid Joining My List Of Blocked Users by:

    Saying Please and Thank you.

    Making requests not demands.

    Checking back on your post. I will not edit any post after 4 days.

    Marking threads as closed once your issue is resolved. How? The tools at the top

    Any reputation (*) points appreciated. None of us gets paid here.

    If you found someone's input useful, please take a second to click the * at the bottom left to let them know

  3. #3
    Registered User
    Join Date
    09-06-2018
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2016
    Posts
    21

    Re: VBA Userform: Check Checkbox when date Textboxes are filled in

    Thanks for the quick reply, mehmetcik. It does not seem to be working for me either. I'm getting a compile error: Variable not defined. It then highlights "Private Sub CheckDates()" and I'm thinking it selects T=. I'm curious about your approach to this solution. What's your thinking? What is T? Thanks again for your insights.

  4. #4
    Forum Guru
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    7,952

    Re: VBA Userform: Check Checkbox when date Textboxes are filled in

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 01-18-2019 at 11:58 AM.

  5. #5
    Registered User
    Join Date
    09-06-2018
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2016
    Posts
    21

    Re: VBA Userform: Check Checkbox when date Textboxes are filled in

    Thanks for your great explanatory comments, mehmetcik! I get it! I suppose since I am using the typical American mm/dd/yyyy or m/d/yyyy, that won't cause a problem. I'm curious if the "variable not defined" error is looking for something else related to T. Oh, and I'm using Excel 2016 (VBA version 7.1 from 2012). If I try to enter a date via date picker or by typing into the field I immediately get the error and it selects "T="

  6. #6
    Forum Guru
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    7,952

    Re: VBA Userform: Check Checkbox when date Textboxes are filled in

    try using

    Dim T as variant at the start of your code

  7. #7
    Registered User
    Join Date
    09-06-2018
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2016
    Posts
    21

    Re: VBA Userform: Check Checkbox when date Textboxes are filled in

    Excellent, mehmetcik! It seems to work. Many thanks I will continue to test it and see if it breaks. I will see if I can adapt it for a single date, though it doesn't look like this code is built for that at all.

  8. #8
    Registered User
    Join Date
    09-06-2018
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2016
    Posts
    21

    Re: VBA Userform: Check Checkbox when date Textboxes are filled in

    I was able to get some time to test and to break the code. When properly applied, it did not break. I found a way to adapt is to check a single textbox as well. I consider this code as a solution. Thanks so very much nemetcik!

+ 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. Want Average on userform textboxes to ignore blank textboxes
    By cvanderweide92177 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-10-2018, 12:47 PM
  2. [SOLVED] UserForm if checkbox is checked then check the others and viceversa
    By bgabi89 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 04-08-2017, 05:36 PM
  3. Userform to check 2 textboxes for duplicate & date check
    By LadyAlina in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-24-2015, 09:26 AM
  4. [SOLVED] UserForm Auto Check check boxes if TextBoxes are not empies
    By MariaPap in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2013, 11:36 AM
  5. Excel userform with date textboxes not filled out.
    By barmfield in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 10-07-2012, 12:47 AM
  6. Replies: 1
    Last Post: 11-29-2010, 06:56 AM
  7. check is input textboxes is numeric on userform
    By Jean-Pierre D via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-16-2005, 04:05 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