+ Reply to Thread
Results 1 to 10 of 10

Delete whole row if column F meets a condition untill last row of data

  1. #1
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Delete whole row if column F meets a condition untill last row of data

    Hi i would like to seek help on vba to Delete whole row if column F meets a condition untill last row of data


    Just to note that the condition is that if a cell = "" | Null | empty delete that partiular row untill the last row of data .. because when i use countblank() = 0 but the cell seem to be empty like jsut white spaces

    in Column F, each row cell suppose to be consisting a word

  2. #2
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Delete whole row if column F meets a condition untill last row of data

    Hi I am not sure I understood You but check this and give the info is it ok?
    Please Login or Register  to view this content.
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  3. #3
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Delete whole row if column F meets a condition untill last row of data

    thanks i shall try and get back to you ! Thanks !

  4. #4
    Forum Contributor PingPing's Avatar
    Join Date
    02-19-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    158

    Re: Delete whole row if column F meets a condition untill last row of data

    Here's a faster algorithm (uses AutoFilter instead of a Loop):
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Delete whole row if column F meets a condition untill last row of data

    Hi tom , tried your codes , good news is that there is not error msg or anything , however bad news is that the row supposingly to be deleted off is still there haha !

    just to provide more information , this blank cells are resulted in one of my previous codes which i split a long string of message ( that in the message there is no spacing in between words an example of a message like : Hicanihelpuyoutodayis12-03-2012)

    i had use

    'splits Text active cell using ALT+10 char as separator
    Application.ScreenUpdating = False
    Dim splitVals As Variant
    Dim totalVals As Long
    'split every row untill is empty
    Worksheets("sheet2").Activate
    Range("F2").Select
    Do Until IsEmpty(ActiveCell.Value)
    splitVals = Split(ActiveCell.Value, Chr(13))
    totalVals = UBound(splitVals)
    Range(Cells(ActiveCell.Row, ActiveCell.Column + 1), Cells(ActiveCell.Row, ActiveCell.Column + 1 + totalVals)).Value = splitVals
    ActiveCell.Offset(1, 0).Select
    Loop

    so there are empty cells between words ( " hi " , "" , "can" , "" , "help" ...... )

    Hope you understand what i am saying =S i not sure how to relate the problem well but this is my try of explaining my problem =S
    Last edited by andywsw; 04-12-2012 at 03:43 AM.

  6. #6
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Delete whole row if column F meets a condition untill last row of data

    send maybe the sample (excel file)

  7. #7
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Delete whole row if column F meets a condition untill last row of data

    BookKeeping.xls

    Here you go a sample data of what i am doing

    Please note the third row consist of blank cells but happens to contain something but i am not sure whats its value is like a space or some value !


    i need to search through all rows of data till the last , deleting whole row like row 3 has

    BTW Please note also that the total table rows varies too , so there are rows similar to row 3 will be in randomly row places or maybe at the last row of all rows too !
    Last edited by andywsw; 04-12-2012 at 04:01 AM.

  8. #8
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Delete whole row if column F meets a condition untill last row of data

    try this then
    Please Login or Register  to view this content.
    or try to change code from other Poster above (faster one)
    p.s. your empty cells contain chr(10)

  9. #9
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Delete whole row if column F meets a condition untill last row of data

    Actually i manage to do it however what i did is that i had selected other columns with cell totally empty and no value and do pings pings methods.
    Which can be one of the methods that i can use ( THANKS pingping ) . However, just to play safe i would like to use column F as the focus as that cells ( that containt some value : "" null or something ) might pop out in another cell if that happens pingping's method wont work accordingly

  10. #10
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Delete whole row if column F meets a condition untill last row of data

    GREAT WORKS LIKE A CHARM THANKS TOMMMMMMMM !!! WOOHO

    May the Thanks be with YOU !! =)))



    btw, had up both of you guy's rep ! thanks !!

+ 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