Results 1 to 8 of 8

Object variable or With block variable not set

Threaded View

  1. #1
    Registered User
    Join Date
    11-08-2012
    Location
    Minnesota
    MS-Off Ver
    Excel 2016
    Posts
    4

    Object variable or With block variable not set

    Hello!

    I'm getting this error, "Object variable or With block variable not set" using this macro:


    FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
    For x = 1 To 2000
    BeginRow = 1
    EndRow = 2000
    ChkCol = 2

    Cells.Find(What:="TOTAL").Select
    StartRange = ActiveCell.Address
    Selection.Offset(3, 0).Select
    EndRange = ActiveCell.Address
    ActiveSheet.Range(StartRange & ":" & EndRange).Select
    Selection.EntireRow.Delete
    Next x



    How do I set the variable or otherwise overcome this? The macro is working, it's just not seeming to come to an error-free end. I want the macro to find each "total" cell and then hide a few rows. The sheet size will vary, so I set an arbitrary number of times to repeat, knowing it won't be more than 2000. But it seems like it's not finding an ending and I don't know how to fix that.

    Thank you!
    Last edited by constructionzone; 08-15-2016 at 03:43 PM.

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