+ Reply to Thread
Results 1 to 7 of 7

I need to be able to select one of 2 cells with a double-click, like a switch

  1. #1
    Forum Contributor
    Join Date
    10-15-2009
    Location
    Austin, TX - USA
    MS-Off Ver
    Microsoft 365
    Posts
    120

    I need to be able to select one of 2 cells with a double-click, like a switch

    My sheet is used to extract numerical values to column B from the pasted text into column A, and columns D, E, and F are used to add, subtract, or to multiply the entered values by selected percentage. Column C is used for alternative values, which are entered directly into the cells in the column. User then selects the column, either B or C, the values of which to be processed in D, E, and F, by double-clicking either the cell B2 or C2. However, I have a few problems with my sheet:

    1. Cells B2 and C2 should function as "either-or" selection: double-click on B2, should put a bullet into the cell and clear the cell C2. Double-clicking C2 should put the bullet into that cell and clear the B2.
    2. When empty, like the A6, columns D, E, and F should remain empty (unlike now as "#VALUE!" is displayed in D6, E6, and F6)
    3. It has been working for me as it is, but it would be nice if D3, E3, and F3 were displaying decimal points: currently, they all display "2500" whereas it really should be "25.00". The problem is that the adjustment controls only allow integers and I was unable to get around it.

    Thanks all in advance!
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: I need to be able to select one of 2 cells with a double-click, like a switch

    1. change your macro do this, should do:
    Please Login or Register  to view this content.
    2. just add ISERROR to your formulas, example for cell D6:

    =IFERROR(IF(B2="•",B6+(D3/10000)*B6,IF(C2="•",C6+(D3/10000)*C6)),"")

    3. not sure how to change this.

  3. #3
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,545

    Re: I need to be able to select one of 2 cells with a double-click, like a switch

    See the attachment.

    Artik
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    10-15-2009
    Location
    Austin, TX - USA
    MS-Off Ver
    Microsoft 365
    Posts
    120

    Re: I need to be able to select one of 2 cells with a double-click, like a switch

    This is almost perfect! Thank you, Artik, rollis13. One more improvement that still remains:

    with the cell formulas =IFERROR(IF(B2="•",B4+(D3/100)*B4,IF(C2="•",C4+(D3/100)*C4)),""), the columns D, E, and F remain empty when empty column B is selected. However, when switching to the empty column C, all cells in D, E, and F display "0.00". I understand that it is because the empty column B is not really empty and it is taken care of the IFERROR formula. The column C is empty and IFERROR, at least in the current formula, does not get picked up. I know that I can use the Conditional Formatting to hide the font color of the zero value, but is there a possibility to do it "the right way" rather than with the "workaround"?

  5. #5
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: I need to be able to select one of 2 cells with a double-click, like a switch

    This in cell D6 will catch #VALUE! for B2 and 0 for C2:

    =IFERROR(IF(B2="•",B6+(D3/100)*B6,IF(AND(C2="•",C6+(D3/100)*C6>0),C6+(D3/100)*C6,"")),"")
    Last edited by rollis13; 04-04-2022 at 10:39 AM.

  6. #6
    Forum Contributor
    Join Date
    10-15-2009
    Location
    Austin, TX - USA
    MS-Off Ver
    Microsoft 365
    Posts
    120

    Re: I need to be able to select one of 2 cells with a double-click, like a switch

    Perfect! Thank you very much!

  7. #7
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: I need to be able to select one of 2 cells with a double-click, like a switch

    Thanks for the positive feedback, glad we were able to help.

+ 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. [SOLVED] Before double click open workbook populate textbox and select optionbutton
    By remco77a in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2021, 06:51 AM
  2. [SOLVED] Double Click one sheet and replicate Double Click "mark" on other sheets
    By jeffreybrown in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-14-2018, 08:43 AM
  3. Replies: 2
    Last Post: 11-12-2016, 05:22 PM
  4. [SOLVED] Add 1 to target on double click, add 0.5 on shift + double click
    By MarmaladeLover in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-26-2015, 06:59 AM
  5. Changing cell properties with double click, then revert with another double click
    By mweber2525 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-01-2014, 01:40 PM
  6. [SOLVED] Double click to select data.
    By JO505 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-06-2013, 06:02 PM
  7. Replies: 2
    Last Post: 02-14-2006, 07:00 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