+ Reply to Thread
Results 1 to 5 of 5

Subroutine to delete a row on double click gone wild!

  1. #1
    Registered User
    Join Date
    07-28-2014
    Location
    Kota Kinabalu, Borneo
    MS-Off Ver
    2011 Mac
    Posts
    16

    Angry Subroutine to delete a row on double click gone wild!

    Hi folks:
    A while back I came to the list with some code to delete a row in a second worksheet based on a deletion of a row in an active cell. I had some great help and guidance from mikerickson and the resulting code looks like this:

    Please Login or Register  to view this content.
    Just as an FYI the counters represent the following: dynamiccounter is the number of rows used by a range I have named. staticcounter is set to equal the numeric value of dynamiccounter to start with, and then changes depending on whether the number of rows changes as per the code line: sourcesheet.Range("BB1").Value = dynamiccounter

    The subroutine deletes a row where I want it to with ease. It works great.

    The problem is a row gats deleted ALSO whenever I type text, or change a font, or do anything....! I am frustrated beyond compare. As far as I am aware I am asking the system to ONLY delete a row if the counters differ in number, and these counters do not change value when a font is changed or when text is written into a cell. They sit quietly to the side doing nothing until one row gets deleted. Only then do the values change and this triggers the deletion in sheet two. So why would a row in sheet two be deleted if I type a word or change a font?

    I REALLY could use your help!
    Nick
    Last edited by npilcher; 08-13-2014 at 08:06 PM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Subroutine to delete a row on double click gone wild!

    Nick

    If you want something to happen when you double click then you should be using the BeforeDoubleClick event, not the change event.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    07-28-2014
    Location
    Kota Kinabalu, Borneo
    MS-Off Ver
    2011 Mac
    Posts
    16

    Re: Subroutine to delete a row on double click gone wild!

    Hi Norie:
    Thanks. Sorry, just realized a dent in my original post and apologies. The double click routine I have works fine. I already have a subroutine to add a row based on a double click on this sheet. It works fine. What I needed was an option to also delete a row in case a user needs to delete a row. That was the code I posted above. So, if a user double clicks and adds a row, but realizes they added a row too many, they need the option to delete it. So I figured I'd let them select the entire row as one would normally, and delete it. And based on that action, the matching row in sheet two would disappear.

    My apologies for not being as clear as I could have been.

    My problem is whatever I do on a row in sheet one deleted the corresponding row in sheet two, not just if I delete a row and the counter numbers change. All and any help much appreciated,
    Nick

  4. #4
    Registered User
    Join Date
    07-28-2014
    Location
    Kota Kinabalu, Borneo
    MS-Off Ver
    2011 Mac
    Posts
    16

    Re: Subroutine to delete a row on double click gone wild!

    Hi Norie:
    Thanks. Sorry, just realized a dent in my original post and apologies. The double click routine I have works fine. I already have a subroutine to add a row based on a double click on this sheet. It works fine. What I needed was an option to also delete a row in case a user needs to delete a row. That was the code I posted above. So, if a user double clicks and adds a row, but realizes they added a row too many, they need the option to delete it. So I figured I'd let them select the entire row as one would normally, and delete it. And based on that action, the matching row in sheet two would disappear.

    My apologies for not being as clear as I could have been.

    My problem is whatever I do on a row in sheet one deleted the corresponding row in sheet two, not just if I delete a row and the counter numbers change. All and any help much appreciated,
    Nick

  5. #5
    Registered User
    Join Date
    07-28-2014
    Location
    Kota Kinabalu, Borneo
    MS-Off Ver
    2011 Mac
    Posts
    16

    Re: Subroutine to delete a row on double click gone wild!

    Sorry folks - I have just realized the title of this post is incorrect. Please see my reply to Nonie just now for a clearer idea of what to do. Question to moderators: Should I remove the post and post a new one? Sorry - new to this thing....

+ 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. ADD/DELETE Cell content on double click
    By belen373 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-30-2014, 07:11 PM
  2. 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
  3. Match and delete row with double click
    By johnny_p in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 10-14-2013, 05:12 PM
  4. Userform: delete all content through double click but not the highlighted line
    By wali in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-10-2010, 05:09 AM
  5. [SOLVED] Textboxes - restrict double-click and selection.delete
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-18-2006, 04:15 PM

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