+ Reply to Thread
Results 1 to 8 of 8

Compile error: Expected End Sub

  1. #1
    Registered User
    Join Date
    03-18-2010
    Location
    denmark
    MS-Off Ver
    Excel 2007
    Posts
    11

    Compile error: Expected End Sub

    Hi

    I'm currently working on a small system where Excel has some rows to calculate. I wont explain in details what is should do, but when i run my VBA is says the error in the title of my thread.

    How my code looks:
    Please Login or Register  to view this content.
    And.
    Is it possible to put more codes in one macro? Like as you see A14:I14 should be 227, and so. Can i put more of the same stuff in, so A15:I15 should be 225. So i only has to enable 1 macro at the time.
    Last edited by Leeboy; 03-18-2010 at 12:44 PM.

  2. #2
    Administrator JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Compile error: Expected End Sub

    If this is a macro that is supposed to activate itself, then remove the first line of code, it's redundant. the ws_change line should be first.

    Also, this macro goes in the Sheet module itself, not a regular module (Module1 or Module2, etc.)

  3. #3
    Registered User
    Join Date
    03-18-2010
    Location
    denmark
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Compile error: Expected End Sub

    I'm not all sure I get what you mean. I have tried to edit some of the stuff, but it comes with a syntex error, or again, with the Expected End Sub.

    What I wan't is to put in alot of different codes, and then activate the one macro.
    Later disable the macro and start a new macro.

    How it looks
    image here
    I want the small tables under to activate when all the numbers in one line are picked.
    The big plate with all the numbers will be empty and filled out with the numbers you pick later on.

    So by calculating the total amount of each line i can make the macro go to a specefic place when the amount is reached.
    I know how to reach the amount and so, but the macro wont work as it should >.<

  4. #4
    Administrator JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Compile error: Expected End Sub

    This thread is about the END SUB error. Don't get your two threads mixed up.

    Take out this line of code:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-18-2010
    Location
    denmark
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Compile error: Expected End Sub

    Quote Originally Posted by JBeaucaire View Post
    This thread is about the END SUB error. Don't get your two threads mixed up.

    Take out this line of code:
    Please Login or Register  to view this content.
    Good ^^ Thanks. It worked.
    New problem arrived. Making a new thread then, so it doesn't mix up.
    Can't give you more points though i would.

  6. #6
    Administrator JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Compile error: Expected End Sub

    If that takes care of this thread, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  7. #7
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Compile error: Expected End Sub

    You shouldn't post a new problem in an existing thread (especially not one which is 2.5 years old), but if you look at the thread you'll find that your answer is in there (hint: you open sub Option1 and then try to open another sub without closing Option1 first).

  8. #8
    Administrator JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Compile error: Expected End Sub

    Andrew, I think you posted in the wrong thread, no activity here.

+ 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