+ Reply to Thread
Results 1 to 11 of 11

Clear Checkboxes macro

  1. #1
    Registered User
    Join Date
    07-21-2016
    Location
    Oregon
    MS-Off Ver
    2016
    Posts
    8

    Clear Checkboxes macro

    I have the following macro and need to insert a command where ******* is to clear the checkboxes that are on sheet "ExpenseEnter". I don't know how to write this part of the code.


    Please Login or Register  to view this content.
    Last edited by alansidman; 07-26-2016 at 08:42 PM. Reason: code tags added

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: Clear Checkboxes macro

    Hi there,

    Try inserting:

    Please Login or Register  to view this content.
    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,751

    Re: Clear Checkboxes macro

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    07-21-2016
    Location
    Oregon
    MS-Off Ver
    2016
    Posts
    8

    Re: Clear Checkboxes macro

    Thanks! I will make sure to do this correctly in the future.

  5. #5
    Registered User
    Join Date
    07-21-2016
    Location
    Oregon
    MS-Off Ver
    2016
    Posts
    8

    Re: Clear Checkboxes macro

    I made a macro with the code you gave me in it and tested it on the worksheet MilesEnter and it works great. When I insert the code like this though, it doesn't work.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: Clear Checkboxes macro

    Hi again,

    I didn't realise that more than one worksheet was involved - try using:

    Please Login or Register  to view this content.
    Hope this helps - as before, please let me know how you get on.

    Regards,

    Greg M

  7. #7
    Registered User
    Join Date
    07-21-2016
    Location
    Oregon
    MS-Off Ver
    2016
    Posts
    8

    Re: Clear Checkboxes macro

    Quote Originally Posted by Greg M View Post
    Hi again,

    I didn't realise that more than one worksheet was involved - try using:

    Please Login or Register  to view this content.
    Hope this helps - as before, please let me know how you get on.

    Regards,

    Greg M
    Thank you for being so patient with me. I almost sent the whole code for this, but was trying to not give more info then necessary. Now I've probably muddled things to much. Yes I am working with several worksheets. I have a main form which I'm using to automate tasks, like opening worksheets for entering etc. One macro on a button is used at the end of each month to save several worksheets as a pdf file, and then clear (reset) the worksheets used for data entry. So that I am getting everything in the right spot and not messing up what I already have working, would you be so kind as to look at the whole code and help me set this bit in where it belongs. Thank you so very much.
    This is the code with no changes made:

    Please Login or Register  to view this content.

  8. #8
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: Clear Checkboxes macro

    Hi again,

    I'm a great believer in breaking code down into bite-sized pieces - it's easier to maintain and it's usually easier to understand.

    See if the following version of your code does what you need:

    Please Login or Register  to view this content.
    Highlighted values can be altered to suit any future changes/requirements.


    The trailing slash in the following statement isn't needed on my installation - you could experiment with omitting it:

    Please Login or Register  to view this content.

    Hope this helps - as before, please let me know how you get on.

    Regards,

    Greg M

  9. #9
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: Clear Checkboxes macro

    Hi again,

    Instead of having three workBOOK-level Defined Names "ClearExpense", "ClearMiles" and "ClearTime", it would be better to have three workSHEET-level Defined Names (each called "tblRangeToClear") - one for each of the worksheets "ExpenseEnter", "MilesEnter" and "TimeEnter".

    Once you've created these names (and deleted the original ones) you can then use the slightly neater version of the following routine instead of the one I posted previously:

    Please Login or Register  to view this content.

    Hope this helps - as always, please keep me informed.

    Regards,

    Greg M

  10. #10
    Registered User
    Join Date
    07-21-2016
    Location
    Oregon
    MS-Off Ver
    2016
    Posts
    8

    Re: Clear Checkboxes macro

    AWESOME!!! Replaced the last section as you suggested and also removed the trailing slash. Everything works beautifully!!! Thank you, thank you, thank you

  11. #11
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: Clear Checkboxes macro

    Hi again,

    Many thanks for your feedback.

    You're very welcome - glad I was able to help.

    Regards,

    Greg M

+ 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] Can I combine a simple "clear" macro with another that clears checkboxes?
    By Maezee in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-22-2013, 01:30 PM
  2. [SOLVED] Clear multiple checkboxes
    By mfortier3 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-25-2013, 12:27 PM
  3. Clear all checkboxes
    By bjohnsonac in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-02-2011, 06:12 PM
  4. [SOLVED] Sheet Checkboxes clear
    By Pete in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2005, 04:05 AM
  5. Replies: 5
    Last Post: 07-29-2005, 08:05 PM
  6. how do i create a macro to clear checkboxes and display a message.
    By Xavierskyrider in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-25-2005, 06:06 PM
  7. Clear All Checkboxes?
    By Brad in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-11-2005, 04:06 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