+ Reply to Thread
Results 1 to 13 of 13

Find values & highlighted and delete rows

  1. #1
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Find values & highlighted and delete rows

    Hello All

    PFA, actually i need two macros, in sheet 2 in column A there is some values i want these value will be searched in sheet "Final"(whole sheet) if found than whole row will get highlighted or at-least cell, second macro delete all these highlighted whole rows.

    in attached sheet i removed other data i just placed data for work.



    Adeel
    Attached Files Attached Files

  2. #2
    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: Find values & highlighted and delete rows

    Hi,

    This is clearly a much simplified example and probably doesn't represent the size of your actual data. We often find that when we give an answer to what is a trivial non representative example when the solution is used with the real world data it doesn't work because of factors like string length and other stuff which is important but hasn't been mentioned.

    Therefore upload your real workbook (or at least a cut down copy), and manually add the results you expect to see. Clearly identify which is original data and which are the results and in a note clearly explain how you have arrived at your results.
    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.

  3. #3
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: Find values & highlighted and delete rows

    Hi,
    i tried to build data, please review

    Adeel
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: Find values & highlighted and delete rows

    please anyone could help on this!!

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: Find values & highlighted and delete rows

    What is the criteria for highlighting. You have not given us enough information. We cannot read your mind and do not have crystal balls. You need to provide a clear explanation of what you wish to happen and there is no discernable data that will require highlighting. All data in column A are the same.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  6. #6
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: Find values & highlighted and delete rows

    Hi,
    i explained it of this opening thread, i will try to explain more, for example, in sheet2 in A1 has value (11111114) and this value is exist in sheet "Final" at O5, that row get highlighted similarly in sheet2 in A2 has value (111111111125) & that exist at P16 in sheet Final that also highlighted & this is same for all in sheet2 column A.

    Adeel

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: Find values & highlighted and delete rows

    This worked for me'

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: Find values & highlighted and delete rows

    thnx Alan this work great, please another macro to delete these highlighted rows i mentioned it in my opening thread!!

    Adeel

  9. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: Find values & highlighted and delete rows

    sure
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: Find values & highlighted and delete rows

    thnx Alan, this is wonderful, please don't mind to amend little first code that when i run first code rows get colored after necessary checking and verification we observed that some part of or all these lines not to be delete and i replace values of sheet2 of column A with some other values or remove some values of present and run the code its keeps colored previous data which should not.!!
    hope you will get my point
    Adeel

  11. #11
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: Find values & highlighted and delete rows

    I have no idea what you mean. Please be explicit in your request. General statements such as yours are no help in providing a solution which is based upon explicit needs.

  12. #12
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: Find values & highlighted and delete rows

    Hi Alan, i tried to make clarity, your provided code working fine, i just want in case if i don't delete highlighted rows with second code and i replace all searching values in sheet2 (column A) with new values and run the code this time that should only highlight new rows as per new values and clear(not delete) highlighting previous rows.

    Adeel

  13. #13
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Find values & highlighted and delete rows

    Alan,

    I think I understand - when the 'search terms' in Sheet2 are changed and your macro re-run, the previously-highlighted rows stay highlighted. If Adeel chooses not to delete those rows with your second macro and then changes the search terms and re-runs the first macro, she would like the previously highlighted rows to be cleared (un-highlighted) if the search term no longer exists on Sheet2. I think a (relatively) simple select all on 'Final' sheet, set ColorIndex to none in the first macro will do it, but my VBA skills aren't good enough for me to just amend your code.
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

+ 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] Find and delete rows using multiple values
    By llessur in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 10-25-2018, 10:28 PM
  2. [SOLVED] Delete Rows based on Highlighted color
    By Grahamfeeley in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-28-2017, 11:48 PM
  3. VBA to delete rows that are not highlighted
    By Pablo14 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-08-2015, 07:41 AM
  4. Delete rows if cell is not highlighted
    By perdooky in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-10-2014, 10:38 AM
  5. Find Highlighted Cells and Delete
    By basketball2524 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-27-2014, 04:56 PM
  6. [SOLVED] Delete non highlighted rows with macro
    By abjac in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-22-2013, 08:23 AM
  7. [SOLVED] How do I delete all rows that contain no red highlighted data?
    By Linda Hudock in forum Excel General
    Replies: 7
    Last Post: 05-22-2006, 04:15 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