+ Reply to Thread
Results 1 to 8 of 8

Object variable or With block variable not set

Hybrid View

  1. #1
    Valued Forum Contributor Neil_'s Avatar
    Join Date
    04-19-2013
    Location
    Yorkshire
    MS-Off Ver
    Office 365 Enterprise E3 2013 / 2016
    Posts
    479

    Re: Object variable or With block variable not set

    It fails when the find doesn't return a range as an object. You need to handle that.
        FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
        For x = 1 To 2000
            BeginRow = 1
            EndRow = 2000
            ChkCol = 2
            
            Set c = Cells.Find(What:="TOTAL")
            If Not c Is Nothing Then
                c.Select
                StartRange = ActiveCell.Address
                Selection.Offset(3, 0).Select
                EndRange = ActiveCell.Address
                ActiveSheet.Range(StartRange & ":" & EndRange).Select
                Selection.EntireRow.Delete
            End If
        Next x
    Last edited by Neil_; 08-15-2016 at 01:27 PM.
    Frob first, tweak later

+ 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. [SOLVED] Run-time error '91': Object variable or With block variable not set when closing userform
    By bishoposiris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-10-2016, 08:59 AM
  2. Advanced Excel - Object variable or With block variable not set (Error 91)??
    By larryg003 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-19-2014, 01:37 PM
  3. Replies: 2
    Last Post: 08-22-2014, 03:55 AM
  4. Replies: 4
    Last Post: 07-12-2013, 12:14 PM
  5. Replies: 6
    Last Post: 12-21-2012, 08:03 AM
  6. Object variable or With block variable not set Error during sorting program
    By BlahBlahBlahBlahBlah in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-17-2012, 07:57 AM
  7. Error 91 object variable block variable not set when importing a CVS file
    By ReportBuilder2011 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-13-2011, 11:48 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