+ Reply to Thread
Results 1 to 8 of 8

change value of cell by a click - 1 or 0

  1. #1
    Registered User
    Join Date
    01-20-2013
    Location
    fort wayne
    MS-Off Ver
    Excel 2010
    Posts
    4

    change value of cell by a click - 1 or 0

    How would I set up a cell for data entry where the value of the cell changes from 0 to 1 or back from 1 to 0 based on a clicking on the cell?

    Thanks Russ - a guy with a 100 surveys to enter

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: change value of cell by a click - 1 or 0

    You would need an event macro to do this.

    Let's assume you want this to happen to cells in the range A1:A100.

    Right click the sheet tab
    Select View Code
    Copy and paste the code below into the window that opens:

    Please Login or Register  to view this content.
    Close the window to return to Excel.

    Try it out.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    01-20-2013
    Location
    fort wayne
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: change value of cell by a click - 1 or 0

    I did install the code. But no luck yet, please look at tab q9-19 on my Excel.
    I did not see how to post it here. So i will put it at a dropbox.

    Russ

  4. #4
    Registered User
    Join Date
    01-20-2013
    Location
    fort wayne
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: change value of cell by a click - 1 or 0

    From Russ:

    "https://www.dropbox.com/sh/lq0g5r1guuzim01/wsLDMZYUjj?m"

    Click here to view Excel

    (Russ shared these files using Dropbox. Enjoy!)

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: change value of cell by a click - 1 or 0

    OK, you need to change the range where you want this to happen.

    Change this line of code from:

    If Not Intersect(Target, Range("A1:A100")) Is Nothing Then
    To:

    If Not Intersect(Target, Range("B2:AJ45")) Is Nothing Then

  6. #6
    Registered User
    Join Date
    12-24-2012
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    33

    Re: change value of cell by a click - 1 or 0

    The code that Tony provided you with is correct and is working. You just need to change the range.
    Based on your excel file the range for your Q9-19 sheet would be
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-20-2013
    Location
    fort wayne
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: change value of cell by a click - 1 or 0

    Works ! yeppie .. I will post the link for all others in the future including myself of this process. You must get off the cell and back into it for switch from 1 back to zero. But, the whole process is just a clicking of binary 1 and 0-s and no drop-downs and numeric keys to press.

    https://www.dropbox.com/sh/lq0g5r1guuzim01/wsLDMZYUjj
    Thanks
    Russ

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: change value of cell by a click - 1 or 0

    You can use the BeforeDoubleClick event so as to not have to be off the cell to make the change.

    Here's the code:

    Please Login or Register  to view this content.
    Now, just left double click the cell and it will toggle between 1 and 0.

+ 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