+ Reply to Thread
Results 1 to 10 of 10

check checkbox value by position

  1. #1
    Registered User
    Join Date
    05-21-2010
    Location
    Berlin
    MS-Off Ver
    Excel 2003 SP3
    Posts
    19

    check checkbox value by position

    Good Morning folks I am looking for a way to check if a position that I can aquire by code (e.g .Cells(x,y)) contains a checkbox and what value (e.g 0 or 1) that checkbox has.
    The reason for this is that I want to automatically create an overview about data in different sheets, ordered by the content of a certain cell as well as by the state of several checkboxes each row.
    The following code is what I came up with concerning the testing of the cell content. Now the row of each cell checked this way also contains a checkbox at .Cells(ICountRow, 2) .Cells(ICountRow, 5) and .Cells(ICountRow, 6). But I don not how how to acces the value of the checkbox therein. The checkboxes used by me are from the Forms toolbar.

    Please Login or Register  to view this content.

    -----
    Sincerely yours John

    PS I already posted the question in an Excel newsgroup but sadly haven't been answered.
    Last edited by grendel_42; 05-21-2010 at 09:08 AM.

  2. #2
    Forum Contributor wamp's Avatar
    Join Date
    11-10-2008
    Location
    Norway
    MS-Off Ver
    97, 2000 & 2003 (diff. workstations)
    Posts
    184

    Re: check checkbox value by position

    this is not an answer to your question, but I would suggest you use marlett checkbox instead. Then you could just check if the cell value contains letter 'x' to see if it's checked or not, thus have more order in your form.

    see this thread for an example of how it's used and how it works.
    _______________________________________________
    Remember:

    Read the rules!

    Use code tags! Place [CODE] before the first line of code and [/CODE] after the last line of code.

    Mark your post [SOLVED] if it has been answered satisfactorily.
    To do this, click EDIT in your original post, click GO ADVANCED and set the PREFIX. It helps everybody!

    If you are approve (or disapprove) of any members response to your problem, please click the star icon underneath their post and comment. It matters.

  3. #3
    Registered User
    Join Date
    05-21-2010
    Location
    Berlin
    MS-Off Ver
    Excel 2003 SP3
    Posts
    19

    Re: check checkbox value by position

    Thanks a lot wamp that might actually make this a lot easier. Will try my best to get it working and post any results here.

    Sincerely yours John

  4. #4
    Registered User
    Join Date
    05-21-2010
    Location
    Berlin
    MS-Off Ver
    Excel 2003 SP3
    Posts
    19

    Re: check checkbox value by position

    Well the work is partially done and I am very content with it so far.
    Please Login or Register  to view this content.
    It fills all my lines with nice little squares or hooks, depending on their state and always indicating their position.
    However for the boxes in the columns H, I and J I was looking to implement something to make sure that at all times only one of them is checked. Originally I had some working code for my checkboxes that relied on the following:
    Please Login or Register  to view this content.
    That would rely on the Application.Caller to find out where it had to do its work, now that this is not valid any longer I tried to implement something along the lines of:
    Please Login or Register  to view this content.
    The only remaining question is, how do I make sure that this code is executed each time one of my cells changes its status?

    Sincerely yours John

  5. #5
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: check checkbox value by position

    Not entirely convinced I follow, but try this:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-21-2010
    Location
    Berlin
    MS-Off Ver
    Excel 2003 SP3
    Posts
    19

    Re: check checkbox value by position

    If I get it correctely your code would delete all content of the three collumns and then just write one hook into the cell I just clicked, but what I want is to only overwrite the two corresponding cells with "z".
    Basically changing from:
    column 1|column 2|column 3
    ___°___|___x___|___° ___
    ___°___|___x___|___° ___
    ___°___|___x___|___° ___
    to:
    column 1|column 2|column 3
    ___°___|___x___|___° ___
    ___°___|___x___|___° ___
    ___x___|___°___|___° ___
    with one click at (2,1)

  7. #7
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: check checkbox value by position

    So there should only be one tick in each row?

  8. #8
    Registered User
    Join Date
    05-21-2010
    Location
    Berlin
    MS-Off Ver
    Excel 2003 SP3
    Posts
    19

    Re: check checkbox value by position

    Correct, one tick each row, at lest between H, I and J while B can be whatever it wants to be

  9. #9
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: check checkbox value by position

    Try this:
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    05-21-2010
    Location
    Berlin
    MS-Off Ver
    Excel 2003 SP3
    Posts
    19

    Re: check checkbox value by position

    Modified it a little bit to my liking and to what I want it to do and am now happy with the result:
    Please Login or Register  to view this content.
    Sincerely yours John

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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