+ Reply to Thread
Results 1 to 3 of 3

Deleting rows based on True/False Criteria

  1. #1
    Registered User
    Join Date
    06-15-2006
    Posts
    9

    Question Deleting rows based on True/False Criteria

    I am attempting to delete entire rows if a certain column is false. This column has the following function:
    =IF(MID(A1,35,3)="CMD",1,"")
    So, if the cell (in column R) is "", I guess, I need the row deleted, and if it is 1, then I want to keep it. I am very lame with VBA and cannot find a command to delete an entire row, and the only example codes I'm finding are to delete blank rows. I have about 12 spread sheets, and each has about 65,000 entries (I would have liked it in 2 but it wouldn't fit, maybe once I delete everything I don't need), so I don't expect it to be fast, but I need some help. Would it be easier if I made the false something other than ""?

    Thanks for the help
    Catherine

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    An easy way to do this is to ...

    Add an additional column and fill it with sequential numbers (1,2,3 etc)
    Sort by the column containing the blanks
    Delete the section containing the rows with the blank columns
    Re-sort by the column with the sequential numbers.
    Delete the sequential numbers column

    By macro you could do something like...

    Please Login or Register  to view this content.
    Set MyColumn to the column of interest. The ScreenUpdating commands are to speed the code up a bit by avoiding refreshing the screen each time.
    Martin

  3. #3
    Registered User
    Join Date
    06-15-2006
    Posts
    9
    Wow, you make me realize I was making it way harder than it was, trying to write scripts. All I had to do was sort by column R and then delete everything below the break between 1 and "".

    Thanks for being the catalyst to that realization

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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