+ Reply to Thread
Results 1 to 10 of 10

Userform code to bring up msgbox if two checkboxes are null

  1. #1
    Forum Contributor
    Join Date
    03-06-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    352

    Question Userform code to bring up msgbox if two checkboxes are null

    Hello,

    I have the following code:

    Please Login or Register  to view this content.
    This is two bring up a msgbox if both the DatePicker checkbox and another checkbox are both unchecked. However when I try to run it it doesn't bring any msgbox up.

    I'm sure this must be a simple fix but I just don't have knowledge myself, can anyone help?

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Userform code to bring up msgbox if two checkboxes are null

    Try:
    Please Login or Register  to view this content.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Forum Contributor
    Join Date
    03-06-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    352

    Re: Userform code to bring up msgbox if two checkboxes are null

    Hi Kev, thanks for the reply but still nothing happens on that part of the code

  4. #4
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Userform code to bring up msgbox if two checkboxes are null

    Where are the CheckBoxes?
    - on a userform?
    - on a sheet?

    If on sheet
    - are you using the CheckBox found in the FORMS toolbar or the CONTROL TOOLBOX toolbar?

  5. #5
    Forum Contributor
    Join Date
    03-06-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    352

    Re: Userform code to bring up msgbox if two checkboxes are null

    The checkboxes are both on a userform

    Both the datepicker and the other checkbox were added from the control toolbox (I then enabled the checkbox on the datepicker from the property window)

  6. #6
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Userform code to bring up msgbox if two checkboxes are null

    Please Login or Register  to view this content.
    Above code works fine - see attached
    Is there an error in one of the names of the checkboxes?
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    03-06-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    352

    Re: Userform code to bring up msgbox if two checkboxes are null

    No still nothing - I think it's because the date picker always has today's date in when I open it, greyed out until I either go to pick a date or tick the checkbox on it. Does this mean the value of the datepicker field is not FALSE so that's why no msgbox is appearing?

    On your Excel you've done two checkboxes, rather than 1 x datepicker with checkbox and 1 x checkbox, so I think that's the difference?

  8. #8
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Userform code to bring up msgbox if two checkboxes are null

    Please attach your workbook - easier to follow and diagnose
    To attach a workbook
    - click GoAdvanced
    - look below and click ManageAttachments
    - follow screen instructions

    If I have time I will look at it tonight, otherwise it will be a few days - travelling without my PC

    You could try ...
    Please Login or Register  to view this content.
    ... to find out what the values actually are and build your code around that.
    Last edited by kev_; 11-06-2017 at 12:43 PM.

  9. #9
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Userform code to bring up msgbox if two checkboxes are null

    I believe that if the checkbox is unchecked the value of the DTPicker will be Null, therefore this should work
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  10. #10
    Forum Contributor
    Join Date
    03-06-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    352

    Re: Userform code to bring up msgbox if two checkboxes are null

    Thanks for your help - it's now sorted

+ 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. [SOLVED] Code for all TextBoxes; Comboboxes and CheckBoxes in an UserForm
    By pipoliveira in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-06-2016, 05:19 AM
  2. [SOLVED] Code failing to detect a null MsgBox value
    By Hyflex in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-09-2014, 06:55 PM
  3. Macro code to check if all checkboxes on userform are false
    By WilliamWu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2013, 03:33 PM
  4. [SOLVED] VBA code - unable to check checkboxes (userform) in Excel 2010
    By mat418pic in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-23-2012, 02:59 PM
  5. UserForm or MsgBox without code interruption?
    By Riggers in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-20-2011, 07:45 AM
  6. Code To Check blank textbox in userform with yes no msgbox
    By jwala in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-01-2010, 05:32 AM
  7. Replies: 1
    Last Post: 11-29-2010, 06:56 AM

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