+ Reply to Thread
Results 1 to 7 of 7

Need help with 'Compile Error: Block If without End If'

  1. #1
    Registered User
    Join Date
    07-15-2016
    Location
    Wisconsin
    MS-Off Ver
    2010
    Posts
    80

    Need help with 'Compile Error: Block If without End If'

    I don't know what happened, but my code was working, then I update a few textbox names and now I keep getting: 'Compile Error: Block If without End If'

    I have gone through and added End If at the end of each If, but it still doesn't work, and I don't know what went wrong. It's more than likely something really easy, but I am having a difficult time figuring it out.

    Maybe one of you will have better luck

    Thank you in advance!
    Attached Files Attached Files

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Need help with 'Compile Error: Block If without End If'

    Hi probably here
    Please Login or Register  to view this content.
    And there are more errors

    Please Login or Register  to view this content.
    You have to place Me before the .
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    07-15-2016
    Location
    Wisconsin
    MS-Off Ver
    2010
    Posts
    80

    Re: Need help with 'Compile Error: Block If without End If'

    It still isn't working, and I have tried multiple variations. I am only having issues when using the Submit Command button

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Need help with 'Compile Error: Block If without End If'

    I had hoped that with my minor correction a small light would burn to make you look through your code and fix the rest.
    There are still a great number of Else and If that are incorrect.
    Just that one section with all the Ifs and Else and incorrect If. take a better look.
    VBA is perseverance, perspiration and time, a whole lot of it.
    Give it a look and you''l see it works. I looked through it and made about 20+ corrections and it works here.
    If you can't get it done, holler and I'll post it.
    But this is the only way to learn

  5. #5
    Registered User
    Join Date
    07-15-2016
    Location
    Wisconsin
    MS-Off Ver
    2010
    Posts
    80

    Re: Need help with 'Compile Error: Block If without End If'

    I just went back through it all and fixed all the areas, and it now works!

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Need help with 'Compile Error: Block If without End If'

    Great, it’s all a question of patience
    I also suggest that you review your code , you could reduce the lines of code by a lot if you avoid repetition and write common routines for the repetitive code you have

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Need help with 'Compile Error: Block If without End If'

    Add the following code to the userform code
    Since your part number should always be numeric, this only allows numbers to be entered

    Please Login or Register  to view this content.

    This will also reduce the number of code lines
    Please Login or Register  to view this content.
    I also suggest you read this link so that you learn how to work with tables.
    https://www.thespreadsheetguru.com/b...0with%20Tables

+ 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. End IF without block IF compile error
    By jdcortez in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-11-2018, 04:20 AM
  2. Compile error. End if without block if
    By ezra_29 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-13-2013, 08:05 AM
  3. Replies: 8
    Last Post: 08-10-2011, 05:14 PM
  4. Excel 2007 : Compile Error: Block if without end if
    By F1lm1 in forum Excel General
    Replies: 2
    Last Post: 08-09-2011, 01:02 PM
  5. Compile Error: End If Without block If
    By mayberce in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-26-2009, 03:32 PM
  6. [SOLVED] Compile Error: Block If without End if
    By [email protected] in forum Excel General
    Replies: 5
    Last Post: 03-03-2006, 02:35 PM

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