+ Reply to Thread
Results 1 to 4 of 4

delete data rows in excel by using a macro?

  1. #1
    Marcia
    Guest

    delete data rows in excel by using a macro?

    I need a macro to delete rows in a 1,000+ page excel report that are
    identified by data in a specific column.

  2. #2
    Tom Ogilvy
    Guest

    RE: delete data rows in excel by using a macro?

    Sub DeleteRows()
    Dim rng as Range
    With columns(3)
    Do
    set rng = .Find(What:="ABC", _
    After:=ActiveCell, _
    LookIn:=xlValues, _
    LookAt:=xlWhole, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, _
    MatchCase:=False)
    if not rng is nothing then
    rng.EntireRow.Delete
    else
    exit do
    End if
    Loop
    end Sub

    --
    Regards,
    Tom Ogilvy

    "Marcia" wrote:

    > I need a macro to delete rows in a 1,000+ page excel report that are
    > identified by data in a specific column.


  3. #3
    Marcia
    Guest

    RE: delete data rows in excel by using a macro?

    I have never created macros. Can you give me the step by step. Not sure
    where to start

    "Tom Ogilvy" wrote:

    > Sub DeleteRows()
    > Dim rng as Range
    > With columns(3)
    > Do
    > set rng = .Find(What:="ABC", _
    > After:=ActiveCell, _
    > LookIn:=xlValues, _
    > LookAt:=xlWhole, _
    > SearchOrder:=xlByRows, _
    > SearchDirection:=xlNext, _
    > MatchCase:=False)
    > if not rng is nothing then
    > rng.EntireRow.Delete
    > else
    > exit do
    > End if
    > Loop
    > end Sub
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Marcia" wrote:
    >
    > > I need a macro to delete rows in a 1,000+ page excel report that are
    > > identified by data in a specific column.


  4. #4
    Tom Ogilvy
    Guest

    RE: delete data rows in excel by using a macro?

    It might be easier for you to select your data, then do
    Data=>filter=>Autofilter

    Select the column that you want to use to determine which rows to delete and
    in that dropdown, select the value that specifies a row for deletion. Now,
    only the header row and the rows to be deleted are visible. Select all the
    data but the header row and do Edit=>Delete and if necessary, select
    entirerow.

    Now do Data=>filter=>Autofilter to turn off the autofilter and only the data
    you wanted to retain should be left.

    Practice this on a copy of your data.

    If you want to learn how to use macros, check some of these out:


    http://msdn.microsoft.com/office/und.../odc_super.asp

    http://msdn.microsoft.com/office/und...d/default.aspx

    http://www.mvps.org/dmcritchie/excel/excel.htm

    http://www.mvps.org/dmcritchie/excel/getstarted.htm


    -------------
    Tutorial - the links to the VBA tutorials follow the Excel tutorial links.
    http://www.mvps.org/dmcritchie/excel....htm#tutorials

    --
    Regards,
    Tom Ogilvy


    "Marcia" wrote:

    > I have never created macros. Can you give me the step by step. Not sure
    > where to start
    >
    > "Tom Ogilvy" wrote:
    >
    > > Sub DeleteRows()
    > > Dim rng as Range
    > > With columns(3)
    > > Do
    > > set rng = .Find(What:="ABC", _
    > > After:=ActiveCell, _
    > > LookIn:=xlValues, _
    > > LookAt:=xlWhole, _
    > > SearchOrder:=xlByRows, _
    > > SearchDirection:=xlNext, _
    > > MatchCase:=False)
    > > if not rng is nothing then
    > > rng.EntireRow.Delete
    > > else
    > > exit do
    > > End if
    > > Loop
    > > end Sub
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > > "Marcia" wrote:
    > >
    > > > I need a macro to delete rows in a 1,000+ page excel report that are
    > > > identified by data in a specific column.


+ 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