Results 1 to 3 of 3

Checkbox to deselect another checkbox, shorter code

Threaded View

  1. #1
    Forum Contributor
    Join Date
    08-04-2008
    Location
    West Calder, Scotland
    MS-Off Ver
    365
    Posts
    430

    Checkbox to deselect another checkbox, shorter code

    Good evening folk

    I'm building a userform which will contain some checkboxes, this is the code I have put into it and it works well

    Private Sub cbact1_Click()
        If cbact1.Value <> 0 Then
            cbact2.Value = 0
            cbact3.Value = 0
        End If
    End Sub
    Private Sub cbact2_Click()
        If cbact2.Value <> 0 Then
            cbact1.Value = 0
            cbact3.Value = 0
        End If
    End Sub
    Private Sub cbact3_Click()
        If cbact3.Value <> 0 Then
            cbact1.Value = 0
            cbact2.Value = 0
        End If
    End Sub
    What I would like to ask is,,, is there a better way to build this code and make it shorter..... or must I use three private subs

    Many thanks
    Last edited by JamesT1; 08-27-2013 at 10:01 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Lock cell linked to checkbox when checkbox is ticked
    By simeony003 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2013, 10:08 AM
  2. Replies: 4
    Last Post: 07-22-2013, 01:37 PM
  3. [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
  4. [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
  5. checkbox on form reset from checkbox on sheet
    By raw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-03-2005, 01:15 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