+ Reply to Thread
Results 1 to 5 of 5

Macro for deleting rows

  1. #1
    benxprezoise
    Guest

    Macro for deleting rows



    I need help in deleting rows. I have sheets with 10 columns with rows
    ranging from 800-2400. I need to delete the rows which has empty data on
    column 1. I would really appreciate your prompt help. Thanks in advance.
    --
    bpz

  2. #2
    Flemming Dahl
    Guest

    Re: Macro for deleting rows

    Public Sub DeleteEmptyRows()
    Dim lRow As Long

    For lRow = 2400 To 800 Step -1
    If Cells(lRow, 1).Value = "" Then
    Cells(lRow, 1).EntireRow.Delete
    Exit For
    End If
    Next lRow
    End Sub

    Cheers,
    Flemming


    "benxprezoise" <[email protected]> wrote in message
    news:[email protected]...
    >
    >
    > I need help in deleting rows. I have sheets with 10 columns with rows
    > ranging from 800-2400. I need to delete the rows which has empty data on
    > column 1. I would really appreciate your prompt help. Thanks in advance.
    > --
    > bpz




  3. #3
    Bob Phillips
    Guest

    Re: Macro for deleting rows

    Range("A800:A2400").SpecialCells(xlCellTypeBlanks).EntireRow.Delete


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "benxprezoise" <[email protected]> wrote in message
    news:[email protected]...
    >
    >
    > I need help in deleting rows. I have sheets with 10 columns with rows
    > ranging from 800-2400. I need to delete the rows which has empty data on
    > column 1. I would really appreciate your prompt help. Thanks in advance.
    > --
    > bpz




  4. #4
    benxprezoise
    Guest

    Re: Macro for deleting rows

    I can't make the formula work.

    This is how my worksheet looks like and lets say I name the range as SAMPLE.

    A B C D
    1 J 01/20/05 123
    2 J 01/20/05 123
    3 01/20/05 123
    .. J 0122 1223
    ..
    ..
    500 J


    I want to delete the rows without J's in column A. Also I need the formula
    to start looking in Row 1.

    Thanks for your help.



    --
    bpz


    "Flemming Dahl" wrote:

    > Public Sub DeleteEmptyRows()
    > Dim lRow As Long
    >
    > For lRow = 2400 To 800 Step -1
    > If Cells(lRow, 1).Value = "" Then
    > Cells(lRow, 1).EntireRow.Delete
    > Exit For
    > End If
    > Next lRow
    > End Sub
    >
    > Cheers,
    > Flemming
    >
    >
    > "benxprezoise" <[email protected]> wrote in message
    > news:[email protected]...
    > >
    > >
    > > I need help in deleting rows. I have sheets with 10 columns with rows
    > > ranging from 800-2400. I need to delete the rows which has empty data on
    > > column 1. I would really appreciate your prompt help. Thanks in advance.
    > > --
    > > bpz

    >
    >
    >


  5. #5
    Bob Phillips
    Guest

    Re: Macro for deleting rows


    "benxprezoise" <[email protected]> wrote in message
    news:[email protected]...
    > I can't make the formula work.
    >
    > This is how my worksheet looks like and lets say I name the range as

    SAMPLE.
    >
    > A B C D
    > 1 J 01/20/05 123
    > 2 J 01/20/05 123
    > 3 01/20/05 123
    > . J 0122 1223
    > .
    > .
    > 500 J
    >
    >
    > I want to delete the rows without J's in column A. Also I need the formula
    > to start looking in Row 1.


    You originally said for rows 800 to 2400, now you are saying starting at 1.

    Try this

    iLastRow = Cells(Rows.Count,"B").End(xlUp).Row
    Range("A1:A" & iLastRow).SpecialCells(xlCellTypeBlanks).EntireRow.Delete



+ 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