+ Reply to Thread
Results 1 to 4 of 4

Help with find error

  1. #1
    Registered User
    Join Date
    08-07-2013
    Location
    Saudi Arabia
    MS-Off Ver
    Excel 2007 - 2010
    Posts
    73

    Help with find error

    Hello guys,

    I did a macro which look for a word in specific and delete delete the next 75 rows, but the problem is, when there are 2 sheets together where the word is missing, it always give me an error to debug it. This is what I have so far:

    Please Login or Register  to view this content.
    I don't know what Im doing wrong. Can you help me please? thanks!!

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Help with find error

    Hi,

    Can you please upload your workbook for me to look at this problem.

    Thanks

  3. #3
    Forum Contributor
    Join Date
    03-21-2012
    Location
    Ho Chi Minh city
    MS-Off Ver
    Excel 2003
    Posts
    180

    Re: Help with find error

    PHP Code: 
    Private Sub BDeleteTreatment()

     
    Dim wsht As WorksheetRng as RangesRng As Range
     Dim findword

    On Error 
    GoTo nws
     
    For Each wsht In Workbooks("MorningReport.xls").Sheets
        wsht
    .Activate '?'
        
    Set Rng Columns("A:C")
        
    Set sRngRng.Find(What:="Lateral"After:=ActiveCellLookIn:=xlFormulas_
           LookAt
    :=xlPartSearchOrder:=xlByRowsSearchDirection:=xlNext_
           MatchCase
    :=TrueSearchFormat:=False)
        If 
    Not Srng Is Nothing Then
            findword 
    sRng.Value

            ActiveCell
    .Rows("1:1").EntireRow.Select  '??'
            
    ActiveCell.Rows("1:75").EntireRow.Select
            Selection
    .Delete Shift:=xlUp
                    
        
    Else
             GoTo 
    nws       
        End 
    If

    nws:
        
        
    Next wsht
    End Sub 
    Last edited by Sa DQ; 09-11-2013 at 03:09 AM.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Help with find error

    Hi, jnh0,

    some minor alterations should do the trick:
    Please Login or Register  to view this content.
    @Sa DQ:
    Please make use of code tags as opposed to PHP tags.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA error 91 error when trying to find double digit
    By pete.n in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-29-2013, 07:03 AM
  2. [SOLVED] Error when using FIND Method to find last row when column is blank
    By the duke in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-01-2013, 10:26 PM
  3. [SOLVED] Compile Error: Can't find project or library (1 computer has the error, another does not?)
    By jonvanwyk in forum Excel Programming / VBA / Macros
    Replies: 34
    Last Post: 06-28-2012, 12:09 PM
  4. Run-time error '91' when 'On error goto' and cells.find
    By bjoern in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2008, 07:27 PM
  5. Replies: 2
    Last Post: 06-10-2006, 04:15 PM

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