+ Reply to Thread
Results 1 to 2 of 2

Macro : To find word and Select rest after this cell and delete rest

Hybrid View

  1. #1
    Registered User
    Join Date
    07-08-2010
    Location
    moscow
    MS-Off Ver
    Excel 2003
    Posts
    1

    Macro : To find word and Select rest after this cell and delete rest

    Hello from moscow..I am the beginer.

    recorded a macro like this.
    i want to find a word..then select after this word 10 row and delete it.
    How can i do this?

    anyone can help?

    thanks in advance.


    Cells.Find(What:="5012039795", After:=ActiveCell, LookIn:=xlFormulas, _
            LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
            MatchCase:=False, SearchFormat:=False).Activate
        Range("B47,A47:I62").Select
    Last edited by pike; 07-08-2010 at 06:30 AM. Reason: add code tags for newbie pm message

  2. #2
    Forum Contributor
    Join Date
    08-02-2007
    Location
    Panama & Austria
    MS-Off Ver
    2003 & 2010
    Posts
    186

    Re: Macro : To find word and Select rest after this cell and delete rest

    Hi Zortabello,
    Use following code:

    On Error Resume Next   'This line makes VBA to ignore errors. (If the .Find option finds no match, it would otherwise pop up a msg box)
    
    Cells.Find(What:="5012039799", After:=ActiveCell, LookIn:=xlFormulas, _
            LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
            MatchCase:=False, SearchFormat:=False).Offset(10, 0).EntireRow.Delete
    
    On Error Resume 0    'This line makes VBA to pop up error mesages again

+ 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