+ Reply to Thread
Results 1 to 9 of 9

need vba code to ensure at least checkbox is ticked - excel 2007

  1. #1
    Registered User
    Join Date
    03-20-2013
    Location
    Grimesland, North Carolina
    MS-Off Ver
    Excel 2007
    Posts
    16

    need vba code to ensure at least checkbox is ticked - excel 2007

    I have 5 checkboxes on sheet 1 of excel 2007 document. I need code/vba/macro (something) to make sure that at least one is picked but all can be picked before save/close.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: need vba code to ensure at least checkbox is ticked - excel 2007

    Hi 3earth

    It depends on what kind of Check Boxes your using
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    03-20-2013
    Location
    Grimesland, North Carolina
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: need vba code to ensure at least checkbox is ticked - excel 2007

    This code works beautifully. I cannot get my tab order to work. The code below is my tab order.
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim iNew As Long

    If IsEmpty(aTabOrd) Then
    aTabOrd = Array("D3", "L3", "D5", "L5", "D7", "L7", "A9", "L9", "D12", "M12", _
    "E17", "F17", "G17", "E18", "F18", "G18", "E19", "F19", "G19", "E20", "F20", _
    "G20", "E21", "F21", "G21", "E22", "F22", "G22", "E23", "F23", "G23", _
    "N16", "N16", "N17", "N18", "N19", "N20", "N21", "J22", "N22", "A26", _
    "W5", "W6", "W7", "W8", "W9", "W10", "W11", "W12", "W13", "W14", "R15", "W15", _
    "W19", "W20", "W21", "R22", "W22", "R28", "T28", "V28", "R30", "T30", "V30", _
    "R37", "T37", "V37", "V39", "Q42")
    nTab = UBound(aTabOrd) + 1
    ITab = 0
    Else
    On Error Resume Next
    iNew = WorksheetFunction.Match(Target(1, 1).Address(False, False), aTabOrd, 0) - 1
    If Err Then
    ITab = (ITab + 1) Mod nTab
    Else
    ITab = iNew
    End If
    On Error GoTo 0
    End If

    Application.EnableEvents = False
    Range(aTabOrd(ITab)).Select
    Application.EnableEvents = True

    End Sub

    I have merged cells.

    NOTE: Forms Toolbox is the one that worked for me.

    thank you

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: need vba code to ensure at least checkbox is ticked - excel 2007

    Hi 3earth

    Please use Code Tags around any Code you post...see Forum Rule #3.

    What does this
    I cannot get my tab order to work
    have to do with this
    I need code/vba/macro (something) to make sure that at least one is picked but all can be picked before save/close.
    Post your file (with existing Code) and let us know what you're trying to do...otherwise, we're just guessing.
    Last edited by jaslake; 03-25-2013 at 05:32 PM.

  5. #5
    Registered User
    Join Date
    03-20-2013
    Location
    Grimesland, North Carolina
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: need vba code to ensure at least checkbox is ticked - excel 2007

    I would like to force the tab order in this document as well as require at least one checkbox (1-7) is choosen.
    Attached Files Attached Files

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: need vba code to ensure at least checkbox is ticked - excel 2007

    Hi 3earth

    I've no personal experience with this but I'll be happy to work on it with you. Having said that, I believe this should be an issue of a new Thread. If you wish to PM me with the Link to that new Thread please feel free to do so.

    In the meantime check out this Link
    http://www.ozgrid.com/forum/showthread.php?t=82272

  7. #7
    Registered User
    Join Date
    03-20-2013
    Location
    Grimesland, North Carolina
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: need vba code to ensure at least checkbox is ticked - excel 2007

    The link did it. I deleted the beginning of the code and did not realize that I had. That is why tab order did not work.

    The link is what I used to force tab order with merged cells. Thank you so much for your help.

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: need vba code to ensure at least checkbox is ticked - excel 2007

    Hi 3earth

    Glad you got it resolved. How about posting your Code so we can all learn..As I stated, I have no personal experience with this and I'd like to see it in action.

  9. #9
    Registered User
    Join Date
    03-20-2013
    Location
    Grimesland, North Carolina
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: need vba code to ensure at least checkbox is ticked - excel 2007

    The code to force tab order with merged cells.

    Please Login or Register  to view this content.
    You will need to modify the cells to your cells. For merged cells, I used the first letter number.
    Last edited by 3earth; 03-27-2013 at 12:30 PM. Reason: forgot to add need to modify cells for your document

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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