+ Reply to Thread
Results 1 to 8 of 8

Delete Unwanted Rows

Hybrid View

mattjchen2@gmail.com Delete Unwanted Rows 07-08-2013, 10:28 AM
AB33 Re: Delete Unwanted Rows 07-08-2013, 10:37 AM
mattjchen2@gmail.com Re: Delete Unwanted Rows 07-08-2013, 10:39 AM
mattjchen2@gmail.com Re: Delete Unwanted Rows 07-08-2013, 10:41 AM
mattjchen2@gmail.com Re: Delete Unwanted Rows 07-08-2013, 10:42 AM
AB33 Re: Delete Unwanted Rows 07-08-2013, 10:48 AM
AB33 Re: Delete Unwanted Rows 07-08-2013, 10:45 AM
mattjchen2@gmail.com Re: Delete Unwanted Rows 07-08-2013, 11:07 AM
  1. #1
    Registered User
    Join Date
    02-19-2013
    Location
    Houston, USA
    MS-Off Ver
    Excel 2010
    Posts
    21

    Delete Unwanted Rows

    Hi,

    Here's the code that I wrote to delete all the rows that not empty in column V. However, it did not work. Please help. Thanks.

    Dim LCell As Range
    Dim X As Long
    X = ActiveSheet.UsedRange.Rows.Count
    For Each LCell In Range("V2:V" & X)
            If LCell.FormularR1C1 <> "" Then
                LCell.Select
                Selection.EntireRow.Select
                Selection.Activate
                Selection.Delete Shift:=xlUp
            End If
    Next
    Best regards,

    Matt
    Attached Files Attached Files
    Last edited by mattjchen2@gmail.com; 07-08-2013 at 10:48 AM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Delete Unwanted Rows

    Matt,
    Please use code tags with your code as per forum's rule.
    Do you mean you want to delete a row if column V is EMPTY? Is it entire row?

  3. #3
    Registered User
    Join Date
    02-19-2013
    Location
    Houston, USA
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Delete Unwanted Rows

    Here's the X for.

    Dim X As Long
    X = ActiveSheet.UsedRange.Rows.Count

  4. #4
    Registered User
    Join Date
    02-19-2013
    Location
    Houston, USA
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Delete Unwanted Rows

    I like to remove the rows that are not Empty. I was not familiar with the code, so I used "=" for a test. Eventually, I will change it to "Not Equal".

  5. #5
    Registered User
    Join Date
    02-19-2013
    Location
    Houston, USA
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Delete Unwanted Rows

    Sorry about the rule. I have to learn it first.

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Delete Unwanted Rows

    My code attached.
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Delete Unwanted Rows

    This line shows that you are testing for empty cell.

    If LCell.FormularR1C1 = "" Then

  8. #8
    Registered User
    Join Date
    02-19-2013
    Location
    Houston, USA
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Delete Unwanted Rows

    Thank you very much AB33. Your code worked perfectly, and provided a lot for me to learn as well.

+ 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