+ Reply to Thread
Results 1 to 18 of 18

DoubleClick not responding immediately

  1. #1
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    DoubleClick not responding immediately

    I have a doubleclick macro that works nicely on one sheet, but with a slight change, is not working well on another sheet.
    The code that isn't working well is below:

    Please Login or Register  to view this content.
    The code on another sheet that works well has one small difference.
    Instead of .Cells I have .EntireRow.

    The code on the first sheet will change the font in the active cell from black to magenta or the reverse, however I must doubleclick _twice before it takes effects.

    I only need to doubleclick once on the other sheet with the .EntireRow code.

    Is there something I can change to make the code work right away for the first sheet?

    TIA
    Last edited by ChrisXcel; 03-05-2014 at 05:53 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: DoubleClick not responding immediately

    Moved from Excel General

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Last edited by 6StringJazzer; 03-05-2014 at 05:43 PM.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    Re: DoubleClick not responding immediately

    Quote Originally Posted by 6StringJazzer View Post

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    I'm sorry I was not aware of this rule.
    I have changed my post and will comply with it going forward.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: DoubleClick not responding immediately

    Hi,

    I assume that's a typo where you say you only want to 'double click' once (sic), and that you just mean you want to click once.
    In which case use the Selection Change event rather than the double click event and remove the 'Cancel' instruction. i.e.

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: DoubleClick not responding immediately

    Default font colorindex will be xlcolorindexautomatic I think so font will change from Automatic (this is usually black) to black then change each time after this. You must test for this also in first test.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  6. #6
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    Re: DoubleClick not responding immediately

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    I assume that's a typo where you say you only want to 'double click' once (sic), and that you just mean you want to click once.
    In which case use the Selection Change event rather than the double click event and remove the 'Cancel' instruction. i.e.
    No actually, it wasn't a typo.
    I thought about it as possibly being misinterpreted that way however.
    The macros are designed to activate as double click events.

  7. #7
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    Re: DoubleClick not responding immediately

    Quote Originally Posted by Izandol View Post
    Default font colorindex will be xlcolorindexautomatic I think so font will change from Automatic (this is usually black) to black then change each time after this. You must test for this also in first test.
    Thanks Izandol for helping out.
    I understand what you are saying, but I'm not sure how to make the suggested change.
    However I will add again, that the same code (except for .cell) works on another sheet, where the code is selecting a row rather than a cell. Why would the code work for that?

  8. #8
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: DoubleClick not responding immediately

    Please Login or Register  to view this content.
    I do not know why this works in other sheet - perhaps you have already set font colour?

    This is different in 2003 from 2007 and later version, where default will be 1 - I do assume that 2002 is same as 2003. Also you must know that if entire row does not have same font colour, you will have error because colorindex will return Null in all versions.

  9. #9
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: DoubleClick not responding immediately

    Quote Originally Posted by ChrisXcel View Post
    No actually, it wasn't a typo.
    I thought about it as possibly being misinterpreted that way however.
    The macros are designed to activate as double click events.
    In that case use the double click event for both the Entire row version and the .cells version. I don't experience the apparent problem you mentioned in your first post so if it's still occurring upload your workbook. so that we can check.

  10. #10
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    Re: DoubleClick not responding immediately

    I conducted a series of experiments to try to get to the bottom of this.

    Worksheet 1 was the worksheet that was 'working'
    Worksheet 3 was the worksheet that wasn't working.

    In Worksheet 3 I double-clicked (dc'ed) on a fresh cell that was black. Nothing happened.
    I dc'ed again and it turned magenta.
    I dc'ed again and it turned black.
    I dc'ed once again and it turned magenta.
    I dc'ed again and it turned black.

    On each fresh cell this pattern repeated.

    Then I went back to a cell I had clicked on before which was now black.

    It turned magenta on the first dc, so it remembered its last state.

    Then I copied the code from Worksheet 1 into Worksheet 3 (first editing out 'cell' dc code) so now the worksheet had 'EntireRow' code.
    I got the exact same response as above.

    So I went back to Worksheet 1 and tested out the code carefully there and sure enough,
    it was working the same way here too!
    The reason why I thought it was working properly in Worksheet1 was because there are a series of rows that I work with over and over, changing the color back and forth. I don't go to fresh rows that often.

    So Izandol was spot on!

    When a fresh cell/row is dc'ed it first turns to black (even if it was black) , then it will turn to magenta on the next dc.

    So now I would like to know how to avoid this?
    Is it possible to enter code that will allow a fresh cell/row to change font color (from black to another color) on the first dc?
    Last edited by ChrisXcel; 03-06-2014 at 05:25 PM.

  11. #11
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: DoubleClick not responding immediately

    Hi,

    In terms of the code it is reacting to whatever is in the cell being clicked and treating all the cells in the row the same.
    Are you saying that if some cells are black and others magenta you want to toggle each of them to the other colour?

  12. #12
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    Re: DoubleClick not responding immediately

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    In terms of the code it is reacting to whatever is in the cell being clicked and treating all the cells in the row the same.
    Are you saying that if some cells are black and others magenta you want to toggle each of them to the other colour?
    No, not quite.
    Let me first talk about the row code.
    All of my rows always have all cells either black or magenta, except for one cell which is either green or red.
    So when I dc on the rows, I want to toggle all of the black cells to magenta or vice versa (except for the one cell which is green/red).

    Now for the cell code.
    The cells I double-click on will always be either a black or magenta colored cell.

  13. #13
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: DoubleClick not responding immediately

    If all cells are not same it will be better to test only Target cell, change entire row and then change green/red cell back to its original colour.

  14. #14
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    Re: DoubleClick not responding immediately

    OK, thanks Izandol.

    I think I know how to get this working now.
    I will play around with it some more and see what I can come up with.
    Last edited by ChrisXcel; 03-07-2014 at 03:07 AM. Reason: Thought about it some more.

  15. #15
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    Re: DoubleClick not responding immediately

    OK I have everything figured out now.
    For my Sheet2 I am using the code below.
    It tests the current cell's font index value.
    If it is automatic, it changes the colour to black and then to magenta.
    If it is black, it changes the colour to magenta.
    If it is magenta, it changes the colour to black.
    This is basically a double-click toggle between two colours, which is what I was looking for.

    For my Sheet1 where I want to double-click toggle between two colours for an entire row, except for one column, I change Target.Font.ColorIndex to Target.EntireRow.Font.ColorIndex.

    As for that one column where the font is either green or red, it isn't really a problem and I don't need special code for it.
    This is because cells in that column are getting their colour from an assignment I have made outside VBA. If value <0 red, if value >=0 green.


    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    Re: DoubleClick not responding immediately

    One other thing. I'm trying to figure out why all the words "o f" (no space between letters) in this post are changed to **?
    Is it just on my machine or do others see this as well?
    Is "o f" a swear word here now?

  17. #17
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: DoubleClick not responding immediately

    Quote Originally Posted by ChrisXcel View Post
    If it is automatic, it changes the colour to black and then to magenta.
    Why do you do two steps?

  18. #18
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    Re: DoubleClick not responding immediately

    Quote Originally Posted by Izandol View Post
    Why do you do two steps?
    Yes you are correct.
    A few minutes ago I was curious, so I tried out a couple more experiments.
    First I jumped straight from automatic to magenta and it worked fine.

    I also wanted to see if I could tighten up the code more by saying 'If auto or black', then 'change to magenta'.
    That worked OK, but strangely the code for changing magenta to black stopped working, so I gave up.

+ 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. On DoubleClick Function
    By mtclimber in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-20-2010, 02:43 AM
  2. Doubleclick event???
    By Denzil in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-09-2008, 07:30 AM
  3. Listbox doubleclick launch
    By HK in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-02-2006, 12:10 PM
  4. doubleclick
    By PH NEWS in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-10-2006, 07:54 AM
  5. What does DoubleClick on a cell do?
    By surotkin in forum Excel General
    Replies: 2
    Last Post: 06-15-2005, 08:51 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