+ Reply to Thread
Results 1 to 17 of 17

Match and delete row with double click

  1. #1
    Forum Contributor
    Join Date
    06-07-2013
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    158

    Match and delete row with double click

    Hi all

    Could you please help as I'm a little stuck. Any help is greatly appreciated.

    Im looking for a way to delete an entire from sheet 1&2 with a double click based on criteria matching a cell on sheet 1.

    For example if I double click on sheet1 C2 the code would match the text in sheet1 H1 with sheet2 D2 and then delete the entire row along with the matching row in sheet1.

    I hope this makes sense.

    I have uploaded the s/sheet.

    Thanks in advance


    Test v1.xls

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Match and delete row with double click

    Hi johnny_p

    Perhaps something like this
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Forum Contributor
    Join Date
    06-07-2013
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    158

    Re: Match and delete row with double click

    Quote Originally Posted by jaslake View Post
    Hi johnny_p

    Perhaps something like this
    Please Login or Register  to view this content.
    Hi

    Thank you for sorting this for me. I does work however it takes about 30secs+ to run through the code.

    Is there a way of making it quicker?

    Thanks again

    John

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Match and delete row with double click

    Hi johnny_p

    The Code runs instantaneously on my platform.

    You might try deleting the extraneous formatting...you have an awfully large file (900+ KB) with NO DATA!

    You may wish to try this
    Please Login or Register  to view this content.
    Last edited by jaslake; 10-10-2013 at 10:07 AM.

  5. #5
    Forum Contributor
    Join Date
    06-07-2013
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    158

    Re: Match and delete row with double click

    Quote Originally Posted by jaslake View Post
    Hi johnny_p

    The Code runs instantaneously on my platform.

    You might try deleting the extraneous formatting...you have an awfully large file (900+ KB) with NO DATA!

    You may wish to try this
    Please Login or Register  to view this content.
    Thanks again for your support with this.

    I have tried your new code and the same happens again. I do have 10,000 line for it to search through. Will this cause the delay?

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Match and delete row with double click

    Hi johnny_p

    Please don't quote entire Posts...quote only relevant parts.

    You ask
    I do have 10,000 line for it to search through. Will this cause the delay?
    Why don't you explain what it is you're trying to do...perhaps there are alternate solutions.

  7. #7
    Forum Contributor
    Join Date
    06-07-2013
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    158

    Re: Match and delete row with double click

    Hi Jaslake

    I have two sheets. The first which is the summary (sheet1). The second (sheet2) holds more detail and can contain up to 20 rows which relate to a single row in sheet1. They are identified by using the same code in sheet1 H1 and sheet2 D2

    When I review the summary I want to be able to delete the row in sheet1 along with all the related rows in sheet2. This will save having to go search and delete the rows.

    Hope this helps?

    Thanks again for your efforts.

    John

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Match and delete row with double click

    Hi John

    How many Records (Rows) are in each Sheet (especially Sheet2)?

    Where does the Data start in each Sheet...a Sample File that has the same Structure as your Actual File would be good.

  9. #9
    Forum Contributor
    Join Date
    06-07-2013
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    158
    The data starts on row 2 in each sheets.

    Sheet2 will have approx 10k rows.

    The sheet I uploaded is the same one I will using.

  10. #10
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Match and delete row with double click

    Hi John

    Yes, but the Sheet you uploaded in Post #1 has no Data in it and does not demonstrate this
    The second (sheet2) holds more detail and can contain up to 20 rows which relate to a single row in sheet1

  11. #11
    Forum Contributor
    Join Date
    06-07-2013
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    158
    Sorry, I clearly under estimated the expected rows.

    I cant add the data as it will be sensitive. It will be approx 10 rows across.

  12. #12
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Match and delete row with double click

    Hi John

    I'd suggest using an AutoFilter approach. Filter Sheet2 on the Value in Sheet1...delete the Sheet2 Filtered Rows.

  13. #13
    Forum Contributor
    Join Date
    06-07-2013
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    158

    Re: Match and delete row with double click

    Hi Jaslake

    I have spent sometime looking into why this takes so long in my live workbook.

    I have quite a few columns with countifs, and index & match functions. In your latest code I see that you turn off the updating functions which does cut the execution time from 60 secs to 30 secs. I have done some thorough testing on both versions and for some reason it only deletes the first match it finds on sheet2 and then continues on.

    This may be the to do with the identifying cell/column (D:D) in sheet2 having a Index/Match function. This connects to sheet1.

    I can avoid this by changing the double click code to on to Sheet1 Col F. I cant however get it if to look for a match on Sheet2 Col C. Would this be to do with the offset?

    I have played around with the autofilters to see if there was some kind of speed improvement, however with all the functions I have there is still quite a delay.

    I may have to settle for the sub 30 sec delay on each execution due to the many functions within the workbook.

    Thanks again for your help and patience with this.

    I hope this makes sense?

    John

  14. #14
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Match and delete row with double click

    Hi John

    The Code I provided is designed to do this
    it only deletes the first match it finds on sheet2
    Multiple matches came late in the game. That's why I suggested
    an AutoFilter approach
    Let me look at it for a bit.

  15. #15
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Match and delete row with double click

    Hi John

    This Code uses the AutoFilter approach I suggested...see if it works for you
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    06-07-2013
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    158

    Re: Match and delete row with double click

    Thanks Jaslake

    Your a star. It seems to be working, altough still takes apporx 30 secs. I dont think this can be helped due to the many functions held within the sheets.

    I will undertake some more testing in the coming days and get back to you.

    Thanks again

    john

  17. #17
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Match and delete row with double click

    Hi John

    Without seeing your Actual File I can't trouble shoot this
    still takes apporx 30 secs
    But if you're satisfied please mark your Thread as SOLVED...

+ 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. 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
  2. Double Click in Merged Cells to insert and delete an "X"
    By Ripperdan in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-16-2010, 10:07 AM
  3. 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
  4. 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
  5. Replies: 4
    Last Post: 08-02-2005, 09:05 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