+ Reply to Thread
Results 1 to 6 of 6

End If Without block if error

  1. #1
    Registered User
    Join Date
    10-06-2010
    Location
    Dunstable,England
    MS-Off Ver
    Excel 2010
    Posts
    95

    End If Without block if error

    Hi

    I have theis pice of cade that looks for a match in a data table, deletes all of the matches from the table and the writes data that was entered into the form to the table.

    I am getting a 'End If with out block if' error and I cant for the life of me work out where the problem is. If i remove the exit sub and end if the code complies and executes but the delete part of the code is skipped.

    can anyone see where I am going wrong?

    Many thanks

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: End If Without block if error

    The 'End If' line you have highlighted has no corresponding 'If'.

  3. #3
    Registered User
    Join Date
    10-06-2010
    Location
    Dunstable,England
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: End If Without block if error

    Sorry but. Where would I put the corresponding if!

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,064

    Re: End If Without block if error

    It depends - what is the condition? (as far as I can see, you can just remove the End If)
    Everyone who confuses correlation and causation ends up dead.

  5. #5
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: End If Without block if error

    I don't know, you put it there! I'm with romperstomper. Take it out and see what happens.

  6. #6
    Registered User
    Join Date
    10-06-2010
    Location
    Dunstable,England
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: End If Without block if error

    Thats what I thought. But when I remove the the end if the program stops after

    Please Login or Register  to view this content.
    The code was working fine untill I added


    Please Login or Register  to view this content.
    I need this because I need to search the data table and remove any matches first.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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