+ Reply to Thread
Results 1 to 6 of 6

Macro to filter cells containing a word ONLY if cell above doesn't contain another word!

  1. #1
    Registered User
    Join Date
    08-16-2015
    Location
    Leicester
    MS-Off Ver
    2007
    Posts
    11

    Red face Macro to filter cells containing a word ONLY if cell above doesn't contain another word!

    Title sounds way more complicated than my problem!

    Basically, I have worked out a macro to reconfigure a csv. All working great but for one issue.

    Data is split by different companies (A, B & C in example below).
    I need the headers - Debtor Name (Row 1) followed by Debtor Account (Row 2).

    However, the debtor account no. is "repeated" on it's own in between some of the lists of invoices.
    I need to delete these "repeat rows" (Row 12, in example below) but keep the headers (Rows 1&2, Rows 4&5, Rows 14&15).

    My thinking was a filter (on Row A) that would list the cells with "Debtor Account" if the cell above did not contain "Debtor Name".

    Sorry, if the explanation is rubbish... I'm sure you can see what I mean from the pic.

    Can anyone help!

    Thanks Matt
    Attached Images Attached Images
    Last edited by MatLCFC; 10-01-2016 at 08:20 PM.

  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,425

    Re: Macro to filter cells containing a word ONLY if cell above doesn't contain another wor

    Can't you just "Remove Duplicates"?
    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
    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,425

    Re: Macro to filter cells containing a word ONLY if cell above doesn't contain another wor

    See: https://support.office.com/en-gb/art...1-8daaec1e83c2

  4. #4
    Registered User
    Join Date
    08-16-2015
    Location
    Leicester
    MS-Off Ver
    2007
    Posts
    11

    Re: Macro to filter cells containing a word ONLY if cell above doesn't contain another wor

    Thanks for the reply

    Hmm... No I don't think that will work. Unless someone can explain exactly how I would implement it.

    I thought I would be able to filter for a cell containing "Debtor Account" ONLY IF Cell above DOES NOT contain "Debtor Number" - Is that possible?

  5. #5
    Registered User
    Join Date
    08-16-2015
    Location
    Leicester
    MS-Off Ver
    2007
    Posts
    11

    Re: Macro to filter cells containing a word ONLY if cell above doesn't contain another wor

    Another way round of looking at... If I filter "Debtor Name" & "Debtor Account" (as below).

    I want the pattern to be Debtor Name then Debtor account. If debtor account appears again (highlighted yellow), I want that line deleted.

    Any ideas people? This is the last problem I need to fix & I have a working macro! AGGGGHHH
    Attached Images Attached Images

  6. #6
    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,425

    Re: Macro to filter cells containing a word ONLY if cell above doesn't contain another wor

    This is the last problem I need to fix & I have a working macro!
    Probably an idea to share what you have and ideally a sample workbook, not a picture of a worksheet.

+ 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] Macro to word wrap text only works on one cell but i need it for multiple cells
    By Triscia in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-29-2016, 12:03 PM
  2. [SOLVED] Help with macro to find a specific word and replace the entire cell with the return word.
    By BG1983 in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 08-24-2015, 09:40 PM
  3. Excel to Word macro doesn't work on Word 2013 if sheet is hidden (works fine on 2010)
    By dreddster in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-29-2015, 04:37 AM
  4. Add text to Existing Word Document if it Doesn't exist create Word Document
    By unstable81 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-10-2013, 12:15 AM
  5. Replies: 2
    Last Post: 10-13-2006, 08:41 AM
  6. Replies: 4
    Last Post: 10-09-2006, 10:03 AM
  7. Replies: 1
    Last Post: 10-12-2005, 01: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