+ Reply to Thread
Results 1 to 5 of 5

Deleting unwanted data from a sheet.

  1. #1
    Forum Contributor
    Join Date
    10-13-2011
    Location
    Australia
    MS-Off Ver
    Office 16
    Posts
    329

    Deleting unwanted data from a sheet.

    I am looking for a solution to remove any row without data in Column E of the attached file.
    If an entry appears in column E then I require all data in that row kept.
    It is a bit like sorting data by column E and if nothing in Column E, then delete entire row.
    If a sort function can be undertaken, then sort by column A.
    I have deleted data that usually appears in columns A and B for privacy.
    Attached Files Attached Files
    Last edited by Christopherdj; 05-03-2012 at 10:44 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Deleting unwanted data from a sheet.

    Hi

    Try this code:

    Sub delrows()
    Dim rcnt As Long

    rcnt = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row

    For i = 1 To rcnt
    If Sheets("Sheet1").Range("A" & i).Value <> "" Then
    If Sheets("Sheet1").Range("E" & i).Value = "" Then
    Sheets("Sheet1").Rows(i & ":" & i).Delete
    i = i - 1
    End If
    End If
    Next
    End Sub
    Regards..
    Click *, if my suggestion helps you. Have a good day!!

  3. #3
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: Deleting unwanted data from a sheet.

    Hi Christopherdj,

    Try this (initially on a copy of your data in case the results are not as expected):

    Please Login or Register  to view this content.
    HTH

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  4. #4
    Forum Contributor
    Join Date
    03-21-2012
    Location
    Ho Chi Minh city
    MS-Off Ver
    Excel 2003
    Posts
    180

    Re: Deleting unwanted data from a sheet.

    PHP Code: 
    Option Explicit
    Sub DeleteBlankCellRows
    ()
     
    Dim Rng As RangedRng As Range
     Dim Rws 
    As Long
     
     Rws 
    Cells.Rows.Count:        Rws Cells(Rws"A").End(xlUp).Row
     Set Rng 
    Range("E1:E" Rws)
     
    Set dRng Rng.SpecialCells(xlCellTypeBlanks).EntireRow
     
    If Not dRng Is Nothing Then dRng.Delete

    End Sub 

  5. #5
    Forum Contributor
    Join Date
    10-13-2011
    Location
    Australia
    MS-Off Ver
    Office 16
    Posts
    329

    Re: Deleting unwanted data from a sheet.

    Thank you all - problem solved.

+ 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