+ Reply to Thread
Results 1 to 18 of 18

Delete entire row based on last part of item matches with sheet name

  1. #1
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Delete entire row based on last part of item matches with sheet name

    I search for macro to delete entire row for DAILY sheet if the last part of item contains the same sheets names when matching with others sheets names
    you will note the last part in item in column B for daily sheet will contain names OMAR, ALI and there are sheets names(OMAR,ALI) then will delete entire row contains names sheets from DAILY sheet to be like as I put the expected result , should be in DAILY sheet
    I will add new sheets and add new data in DAILY sheet every time
    the data could reach 4000 rows in DAILY sheet and the sheets could be 20sheets.
    also I posted here
    https://www.mrexcel.com/board/thread...-name.1243958/
    and no answering so far !
    I hope find help here.
    Attached Files Attached Files
    Last edited by Ali-M; 09-01-2023 at 08:11 AM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,607

    Re: Delete entire row based on last part of item matches with sheet name

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Delete entire row based on last part of item matches with sheet name


    Quote Originally Posted by Ali-M View Post
    also I posted here
    and no answering so far
    Hoping you've understood where to not waste time anymore …

  4. #4
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Re: Delete entire row based on last part of item matches with sheet name

    @jindon
    that's great!
    this is exactly what I want it .
    thank you so much.

  5. #5
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Re: Delete entire row based on last part of item matches with sheet name

    Hoping you've understood where to not waste time anymore …
    jindon doesn't say that , obviously my thread is clear .
    it's not necessary no answer in the other form mean my subject is not clear . maybe the members who master vba couldn't available.
    even if I suppose this is not clear , but my subject is not worse to any member ignore my subject.
    I no know why to say that . even my previous thread you don't try to help me what I ask you for my mistake so I left the previous thread without ask you again because obviously you don't want answer me .

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Delete entire row based on last part of item matches with sheet name


    Well you misread my post so you badly misunderstood as the subject is not me, neither about my help
    but where you have first created your thread ‼

    As I have no clue about which thread you are stating about so attach at least a link …

  7. #7
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Re: Delete entire row based on last part of item matches with sheet name

    @jindon
    based on your code will delete any row contains FROM & TO words but not delete in all of cases .
    as I said
    if the last part of item contains the same sheets names when matching with others sheets names
    well I don't post some data for this case , so doesn't the match with sheet name
    when you find some names after FROM and TO are not matched with sheet name, then shouldn't delete them so I edited file by highlighted rows in DAILY sheet should keep it , expected result .
    I hope you have time to see it.

  8. #8
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Re: Delete entire row based on last part of item matches with sheet name

    Well you misread my post so you badly misunderstood as the subject is not me, neither about my help
    sorry from your comment I understood my subject is not clear when you say
    to not waste time anymore
    well I asked RIGHT function in my previous thread how merge with IF function by vba to adapt with my mistake(POSTS#21,22).


    https://www.excelforum.com/excel-pro...ml#post5862968

  9. #9
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Delete entire row based on last part of item matches with sheet name


    But I answered, did you try to make any effort - very beginner level Excel formula - at least ?‼
    As I'm not a mind reader, as you did not answer and according to the obvious easy formula so on my side it was already solved …

  10. #10
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,852

    Re: Delete entire row based on last part of item matches with sheet name

    Some of the Account Names in column B have trailing spaces. Before trying this macro delete any trailing spaces in column B.
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,607

    Re: Delete entire row based on last part of item matches with sheet name

    Ali-M

    Such thing is quite annoying, because of your poor sample workbook.
    Please Login or Register  to view this content.
    Last edited by jindon; 09-01-2023 at 09:25 AM.

  12. #12
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Delete entire row based on last part of item matches with sheet name


    Quote Originally Posted by Mumps1 View Post
    Some of the Account Names in column B have trailing spaces.
    Indeed, but no matters when not relative to 'OMAR' & 'ALI' …

  13. #13
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,852

    Re: Delete entire row based on last part of item matches with sheet name

    @Marc L
    If not deleted, the trailing spaces affect the value of:
    Please Login or Register  to view this content.

  14. #14
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Try this !


    Ok Mumps1. (just using Trim …)

    Anyway according to the original post attachment as it is a starter VBA demonstration to paste only to DAILY worksheet module :

    PHP Code: 
    Sub Demo2()
        
    Dim S$(), N&, Rc As Range
            
    If Sheets.Count Index Then Exit Sub
            ReDim S
    (Index 1 To Sheets.Count)
            For 
    Index 1 To Sheets.Count:  S(N) = Sheets(N).Name:  Next
            Application
    .ScreenUpdating False
       With 
    [A1].CurrentRegion
        
    For Each Rc In .Range("B2:B" & .Rows.Count)
            If 
    IsNumeric(Application.Match(Mid(RcInStrRev(Rc" ") + 1), S0)) Then Rc.ClearContents
        Next
            
    If IsEmpty(.Cells(2).End(xlDown)(0)) Then .Columns(2).SpecialCells(4).EntireRow.Delete
       End With
            Application
    .ScreenUpdating True
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 09-01-2023 at 10:32 AM.

  15. #15
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Re: Delete entire row based on last part of item matches with sheet name

    Such thing is quite annoying, because of your poor sample workbook.
    sorry about it !
    it's perfect .
    thanks again.

  16. #16
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Re: Delete entire row based on last part of item matches with sheet name

    some of the Account Names in column B have trailing spaces.
    thanks for inform me , seem the reason to be from the spaces will show mismatch error in this line
    Please Login or Register  to view this content.
    when I delete the spaces the code works greatly .
    thank you so much, Mumps.

  17. #17
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,852

    Re: Delete entire row based on last part of item matches with sheet name

    You are very welcome.

  18. #18
    Forum Contributor
    Join Date
    11-14-2021
    Location
    africa
    MS-Off Ver
    2016 & 2019
    Posts
    255

    Re: Delete entire row based on last part of item matches with sheet name

    that's very great , Marc !
    But I answered, did you try to make any effort - very beginner level Excel formula - at least ?‼
    I will comment in the other thread as I provided the link in post#8. I don't think good idea to comment here .
    thank you for answering here.
    Last edited by Ali-M; 09-01-2023 at 11:47 AM.

+ 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] delete characters based on match part of item for helper column across sheets.
    By Ali-M in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-03-2023, 02:57 PM
  2. [SOLVED] delete entire row if doesn't matches
    By MoldyBread in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-11-2020, 08:29 AM
  3. Delete Entire Row on Every Sheet if Date Condition Matches
    By c052463 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-16-2020, 12:53 PM
  4. delete entire row based on part of a cell value
    By sunmixed in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-07-2019, 11:45 AM
  5. Filtered ListBox Selected item delete in sheet Entire Row
    By sijostephen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-05-2019, 05:38 PM
  6. [SOLVED] Delete entire row based on cell value in another sheet
    By DespoExcel in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-21-2014, 01:43 PM
  7. Copy part of a row to a new sheet then delete whole row based on text value
    By badgerboy13 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-29-2012, 12:31 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