+ Reply to Thread
Results 1 to 3 of 3

Link this code to a checkbox

  1. #1
    Registered User
    Join Date
    02-02-2014
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    37

    Link this code to a checkbox

    I have this code:

    Please Login or Register  to view this content.
    That puts the row number of the active cell in A1. However, when it is enabled, I can't undo anything or paste to the worksheets. How do I link this to a checkbox (i.e., when the checkbox is ticked, the above code should be active and when it is unticked, it should be inactive).

    Thanks in advance!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Link this code to a checkbox

    Hello zanguard80,

    When using either the Change or SelectionChange event, modifying a cell or a range will trigger the event again. This will lock up Excel or crash it.

    To prevent this, you need to suspend responding to events until your macro is complete. Events need to be re-enabled before you exit the macro or before the macro finishes.

    Here is how to do it...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    03-04-2014
    Location
    Canada Eh
    MS-Off Ver
    Excel 2010
    Posts
    199

    Re: Link this code to a checkbox

    Have you tried using ActiveX controls for your check boxes? They are super easy to code and function well.
    Click the * to give Rep to a post you like.

+ 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] Checkbox to deselect another checkbox, shorter code
    By JamesT1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-27-2013, 09:59 AM
  2. [SOLVED] VBA code to uncheck checkbox 2 & 3 if checkbox 1 is checked
    By hydz1213 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-25-2013, 03:10 AM
  3. [SOLVED] How do I change a checkbox to unchecked without running the code within the checkbox
    By jsunnb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-27-2012, 09:28 PM
  4. [SOLVED] Checkbox to Link Cells to another Worksheet
    By djsli in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-22-2012, 11:10 AM
  5. [SOLVED] How do I link one checkbox to update another checkbox?
    By Mike in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-27-2006, 09:25 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