+ Reply to Thread
Results 1 to 4 of 4

End If without Block If error

  1. #1
    Forum Contributor
    Join Date
    03-21-2004
    Location
    Norwich, CT USA
    MS-Off Ver
    Excel 2010
    Posts
    163

    End If without Block If error

    To try and trap a separate error, I added and if, then else. However I keep getting "Compile Error: End If without Block If error" the "if" and "end if" count seems right to me. what am I missing?

    Please Login or Register  to view this content.
    The part I changed was:

    Please Login or Register  to view this content.

    prior to trying to build the error trap it was simply:
    Please Login or Register  to view this content.
    which did not return the End If without Block If error (but has a separate issue)
    Thanks
    Robert

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,962

    Re: End If without Block If error

    ISERROR is a worksheet function and you can't use it, as you have, in VBA.

    You'd need to use "On Error Resume Next" and test the Err.Number for a non-zero value. Then use "On Error Goto 0" to switch off the error trapping.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    03-21-2004
    Location
    Norwich, CT USA
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: End If without Block If error

    TMS, I'm sorry I did not thank you right away. Thanks for correcting my usage if the ISERROR and pointing me off in the right direction. With the error trap fixed I still haven't fixed the original problem but Ill cover that in a separate post.
    Thanks again for helping and responding to my post so quickly..
    Robert

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: End If without Block If error

    If you have indented your ifs, you could have easily spotted the error.

    Please Login or Register  to view this content.

+ 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. Replies: 5
    Last Post: 10-09-2012, 10:44 AM
  2. end if without block if error
    By prajesh in forum Excel General
    Replies: 13
    Last Post: 11-17-2011, 04:51 AM
  3. End If Without block if error
    By nods in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-09-2010, 11:52 AM
  4. End If with out block if error
    By nods in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-08-2010, 02:13 PM
  5. [SOLVED] VBA error - End If without Block If
    By Jane in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-06-2005, 02:10 PM

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