+ Reply to Thread
Results 1 to 6 of 6

Loop through checkbox and inputs data based on which is checked

  1. #1
    Registered User
    Join Date
    03-10-2016
    Location
    usa
    MS-Off Ver
    2010
    Posts
    5

    Loop through checkbox and inputs data based on which is checked

    Hi,
    Im pretty new to VBA,just 2 weeks now.
    I'm trying to make a userform that does estimate of lengths for cables.
    here's the problem:
    I created a series of checkbox and trying to create a code that scans all the checked checkbox and outputs them accordingly.
    ex. checkbox1 goes to cell(2,1) but if checkbox1 is not selected then checkbox2 goes to cell(2,1)..etc
    How do i do this? Any help would be great..
    heres my code so far
    Please Login or Register  to view this content.
    edited:
    i think i added my file now
    Attached Files Attached Files
    Last edited by joe8904; 03-10-2016 at 03:10 PM. Reason: added file

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Loop through checkbox and inputs data based on which is checked

    You are going down a dead end.

    You should have attached your spreadsheet, so I could correct your code for you.

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 03-10-2016 at 01:26 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    03-10-2016
    Location
    usa
    MS-Off Ver
    2010
    Posts
    5

    Re: Loop through checkbox and inputs data based on which is checked

    mehmetcik, I've edited my original post now. Will try your code to see if it works for my case.Thanks

  4. #4
    Registered User
    Join Date
    03-10-2016
    Location
    usa
    MS-Off Ver
    2010
    Posts
    5

    Re: Loop through checkbox and inputs data based on which is checked

    mehmetcik,
    Didnt quite work the way I wanted it to do..but your code gave me some insight of cell selection. Will try to work out a cell selection type module and see if that solves my problem.

  5. #5
    Registered User
    Join Date
    03-10-2016
    Location
    usa
    MS-Off Ver
    2010
    Posts
    5

    Re: Loop through checkbox and inputs data based on which is checked

    Hey guys,
    Here's my logic to what I meant in this bost.
    The code I'm trying to create is designating one cell to multiple checkbox.caption but if that first checkbox is ticked in that set of checkboxes, the cell moves down for the next ticked checkbox.
    That way at any instance a checkbox is ticked, the output will be sorted in each cell automatically without any gaps between the data.
    I'm sure this is possible but haven't got the right syntax needed for the coding.
    Please advise or provide with a code. All help is much appreciated

  6. #6
    Registered User
    Join Date
    03-10-2016
    Location
    usa
    MS-Off Ver
    2010
    Posts
    5

    Re: Loop through checkbox and inputs data based on which is checked

    Found my solution. Create an array to store the values and output it to each cell based on number of checkbox ticked.

+ 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. If checkbox checked then data validation
    By mdek in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-04-2016, 11:21 AM
  2. [SOLVED] When checkbox is checked it does not copy to new sheet. Only if not checked using false
    By thelisa in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-28-2013, 07:59 AM
  3. Return data to datasheet when checkbox in the form is checked
    By Apple Ling in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-14-2013, 02:09 AM
  4. [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
  5. CheckBox copies data when checked but needs to also remove data when unchecked
    By matrixpom in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-29-2012, 03:34 AM
  6. [SOLVED] Excel VBA calculating Average based on checked CheckBox
    By Kinez101 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-26-2012, 02:39 PM
  7. Copy row data for checked checkbox
    By Christeen in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-09-2011, 09:50 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