+ Reply to Thread
Results 1 to 5 of 5

Search and destroy

  1. #1
    Pugwyrm
    Guest

    Search and destroy

    Hi
    I'm trying to write a macro to search for something then move one rwo and
    then delete two rows.

    I can do the search and the delete but I cannot do the move and the
    selecting of two rows!

    Any ideas please but I lose any more sleep?

    Thanks
    MB

  2. #2
    Tom Ogilvy
    Guest

    Re: Search and destroy

    Post your code so we have some idea of what technique you are using to
    search and so forth.

    --
    regards,
    Tom Ogilvy

    "Pugwyrm" <[email protected]> wrote in message
    news:[email protected]...
    > Hi
    > I'm trying to write a macro to search for something then move one rwo and
    > then delete two rows.
    >
    > I can do the search and the delete but I cannot do the move and the
    > selecting of two rows!
    >
    > Any ideas please but I lose any more sleep?
    >
    > Thanks
    > MB




  3. #3
    Pugwyrm
    Guest

    Re: Search and destroy

    OK, this is what I have so far (and I've only got this far by Recording a
    macro...)

    Range("A1").Select
    Cells.Find(What:="No History", After:=ActiveCell, LookIn:=xlFormulas, _
    LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    MatchCase:=False, SearchFormat:=False).Activate
    Rows("4:5").Select
    Selection.Delete Shift:=xlUp

    Its the "Rows("4:5").Select that I need to automate as it won't always be
    rows 4 and 5

    Thanks

    "Tom Ogilvy" wrote:

    > Post your code so we have some idea of what technique you are using to
    > search and so forth.
    >
    > --
    > regards,
    > Tom Ogilvy
    >
    > "Pugwyrm" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hi
    > > I'm trying to write a macro to search for something then move one rwo and
    > > then delete two rows.
    > >
    > > I can do the search and the delete but I cannot do the move and the
    > > selecting of two rows!
    > >
    > > Any ideas please but I lose any more sleep?
    > >
    > > Thanks
    > > MB

    >
    >
    >


  4. #4
    Tom Ogilvy
    Guest

    Re: Search and destroy

    Dim rng as Range
    Range("A1").Select
    set rng =Cells.Find(What:="No History", After:=ActiveCell,
    LookIn:=xlFormulas, _
    LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    MatchCase:=False, SearchFormat:=False)
    if not rng is nothing then
    rng.offset(2,0).Resize(2).EntireRow.Delete
    End If

    if there will be multiple occurances of "No History"

    Dim rng as Range
    Range("A1").Select
    set rng =Cells.Find(What:="No History", _
    After:=Range("A65536"), _
    LookIn:=xlFormulas, _
    LookAt:=xlPart, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, _
    MatchCase:=False, _
    SearchFormat:=False)
    if not rng is nothing then
    frow = rng.row
    do
    rng.offset(2,0).Resize(2).EntireRow.Delete
    set rng = cell.findnext(rng)
    Loop while rng.row > fRow
    End If


    "Pugwyrm" <[email protected]> wrote in message
    news:[email protected]...
    > OK, this is what I have so far (and I've only got this far by Recording a
    > macro...)
    >
    > Range("A1").Select
    > Cells.Find(What:="No History", After:=ActiveCell, LookIn:=xlFormulas,

    _
    > LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    > MatchCase:=False, SearchFormat:=False).Activate
    > Rows("4:5").Select
    > Selection.Delete Shift:=xlUp
    >
    > Its the "Rows("4:5").Select that I need to automate as it won't always be
    > rows 4 and 5
    >
    > Thanks
    >
    > "Tom Ogilvy" wrote:
    >
    > > Post your code so we have some idea of what technique you are using to
    > > search and so forth.
    > >
    > > --
    > > regards,
    > > Tom Ogilvy
    > >
    > > "Pugwyrm" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > Hi
    > > > I'm trying to write a macro to search for something then move one rwo

    and
    > > > then delete two rows.
    > > >
    > > > I can do the search and the delete but I cannot do the move and the
    > > > selecting of two rows!
    > > >
    > > > Any ideas please but I lose any more sleep?
    > > >
    > > > Thanks
    > > > MB

    > >
    > >
    > >




  5. #5
    Pugwyrm
    Guest

    Re: Search and destroy

    Cheers, it's a start!

    "Tom Ogilvy" wrote:

    > Dim rng as Range
    > Range("A1").Select
    > set rng =Cells.Find(What:="No History", After:=ActiveCell,
    > LookIn:=xlFormulas, _
    > LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    > MatchCase:=False, SearchFormat:=False)
    > if not rng is nothing then
    > rng.offset(2,0).Resize(2).EntireRow.Delete
    > End If
    >
    > if there will be multiple occurances of "No History"
    >
    > Dim rng as Range
    > Range("A1").Select
    > set rng =Cells.Find(What:="No History", _
    > After:=Range("A65536"), _
    > LookIn:=xlFormulas, _
    > LookAt:=xlPart, _
    > SearchOrder:=xlByRows, _
    > SearchDirection:=xlNext, _
    > MatchCase:=False, _
    > SearchFormat:=False)
    > if not rng is nothing then
    > frow = rng.row
    > do
    > rng.offset(2,0).Resize(2).EntireRow.Delete
    > set rng = cell.findnext(rng)
    > Loop while rng.row > fRow
    > End If
    >
    >
    > "Pugwyrm" <[email protected]> wrote in message
    > news:[email protected]...
    > > OK, this is what I have so far (and I've only got this far by Recording a
    > > macro...)
    > >
    > > Range("A1").Select
    > > Cells.Find(What:="No History", After:=ActiveCell, LookIn:=xlFormulas,

    > _
    > > LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    > > MatchCase:=False, SearchFormat:=False).Activate
    > > Rows("4:5").Select
    > > Selection.Delete Shift:=xlUp
    > >
    > > Its the "Rows("4:5").Select that I need to automate as it won't always be
    > > rows 4 and 5
    > >
    > > Thanks
    > >
    > > "Tom Ogilvy" wrote:
    > >
    > > > Post your code so we have some idea of what technique you are using to
    > > > search and so forth.
    > > >
    > > > --
    > > > regards,
    > > > Tom Ogilvy
    > > >
    > > > "Pugwyrm" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > Hi
    > > > > I'm trying to write a macro to search for something then move one rwo

    > and
    > > > > then delete two rows.
    > > > >
    > > > > I can do the search and the delete but I cannot do the move and the
    > > > > selecting of two rows!
    > > > >
    > > > > Any ideas please but I lose any more sleep?
    > > > >
    > > > > Thanks
    > > > > MB
    > > >
    > > >
    > > >

    >
    >
    >


+ 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