+ Reply to Thread
Results 1 to 7 of 7

I need to clear the value of the first cell of the row that is double-clicked

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

    I need to clear the value of the first cell of the row that is double-clicked

    What would be the line of code to clear the value of the first cell of the row that is double-clicked? The row 2, for example: I have random values in cells A2:A10, but I want only A2 to be cleared if I double-click anywhere in the range of B2:G2, where I have set Cancel = True
    Last edited by 6StringJazzer; 11-26-2021 at 04:35 PM. Reason: Moved from Excel Formulas & Functions

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: I need to clear the value of the first cell of the row that is double-clicked

    Untested, but try:
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    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: I need to clear the value of the first cell of the row that is double-clicked

    I am pretty sure Trevor's code will work ("=" not needed) but I would inclined to use
    Please Login or Register  to view this content.
    Target is more reliably the cell that was double-clicked, although I can't think of a way that it would not also be ActiveCell. Also, I happen to like letter column references vs. numeric, just personal preference.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

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

    Re: I need to clear the value of the first cell of the row that is double-clicked

    Thank you very much, y'all!

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: I need to clear the value of the first cell of the row that is double-clicked

    You're welcome. Thanks for the rep.

  6. #6
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: I need to clear the value of the first cell of the row that is double-clicked

    Quote Originally Posted by 6StringJazzer View Post
    Also, I happen to like letter column references vs. numeric, just personal preference.
    You can avoid the whole column letter vs numeric preference issue by doing it this way instead...

    Target.EntireRow.Cells(1).ClearContents

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: I need to clear the value of the first cell of the row that is double-clicked

    @6SJ: missed your comment. Not exactly sure how that equals sign got there, but it wasn't meant to be. The perils of drafting untested code on an iPad strike again. In a quandary now whether to correct it as that would lose the context for your comment .

    It should work ok as double clicking the cell would make it the Active cell. But I think Target is preferable.

+ 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] Cell Will Not Change Format Until Double Clicked
    By meppwc in forum Excel General
    Replies: 8
    Last Post: 07-11-2023, 07:50 AM
  2. Copy double-clicked cell to next empty row in different sheet with each double-click
    By erhathaway in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-25-2013, 12:06 AM
  3. [SOLVED] Load web image when cell holding URL is clicked/double-clicked
    By jchamber00 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-20-2013, 09:13 PM
  4. Replies: 4
    Last Post: 09-11-2012, 12:47 PM
  5. [SOLVED] Record time stamp once cell is double clicked
    By stoey in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-17-2012, 09:23 AM
  6. If a cell containing a specific term is double clicked then
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-23-2012, 01:08 AM
  7. Change cell value when right-clicked/double-clicked
    By grime in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-17-2005, 09:05 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