Results 1 to 5 of 5

Run Time Error '91' Object Variable or block variable not set

Threaded View

  1. #1
    Registered User
    Join Date
    07-18-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    2

    Run Time Error '91' Object Variable or block variable not set

    I am writing a code for my job but I have hit a road block. I need to write a macro that checks sheet 1 for a specific number then if that number is not found then it searches three other sheets and if the number is found it deletes it. My problem is that I get an error (Run Time Error '91' Object Variable or block variable not set) when i run the program for a number that is not found on one of the subsequent sheets. Ive been working on this for days and I cant figure it out. Heres the code with the number replaced with stars

    Sub Macro2()
    '
    ' Macro2 Macro
    '
    
    '
        Sheets("Master").Select
        If Range("C1").Value = "*********" Then
        
        Else
        Sheets("ERT").Select
        If Cells.Find(What:="***********", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
            :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
            False, SearchFormat:=False).Activate = True Then
        ActiveCell.ClearContents
        End If
        Sheets("FT Phone").Select
        If Cells.Find(What:="**********", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
            :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
            False, SearchFormat:=False).Activate = True Then
        ActiveCell.ClearContents
        End If
        Sheets("Staff Does Not Report").Select
        If Cells.Find(What:="**********", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
            :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
            False, SearchFormat:=False).Activate = True Then
        ActiveCell.ClearContents
        End If
    End If
    
    End Sub
    Last edited by leao67; 07-19-2013 at 10:38 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA Coding Style - Exit Points - What are good methods for coding Exit Points?
    By CHatmaker in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-11-2013, 05:30 PM
  2. [SOLVED] CheckBox coding to work with ComboBox coding
    By JimExcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-05-2013, 12:23 PM
  3. Coding and Reverse Coding a Questionnaire
    By lorr3 in forum Excel General
    Replies: 2
    Last Post: 11-18-2012, 06:43 PM
  4. [SOLVED] Implant macro coding into ASP coding
    By Sam yong in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-15-2005, 06:05 AM
  5. Need coding help.
    By Neddy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-17-2005, 08:05 AM

Tags for this Thread

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