+ Reply to Thread
Results 1 to 15 of 15

Compile Error VBA error code attached

  1. #1
    Registered User
    Join Date
    05-21-2015
    Location
    Tulsa, OK
    MS-Off Ver
    2010
    Posts
    9

    Compile Error VBA error code attached

    When new users open the file they receive a "Compile error: Can't find project or library" error. Below is my VBA written to open up a worksheet when the field is selected and and also is a multi select drop down box data validation. Any help would be appreciated....

    Also when looking at my script can you help me make the multi select appear in its own cell when selected?

    Please Login or Register  to view this content.
    Thanks
    Cindy
    Last edited by cgibson92; 06-01-2015 at 11:04 AM. Reason: title wrong

  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,425

    Re: Compile Error... HELP!!!!!

    Hi Cindy, and welcome to the forum. Please take a few moments to read the forum rules and then 1) change your thread title to something more descriptive, 2) add Code Tags to your code excerpt, and, ideally, 3) post a sample workbook.

    I suspect that it is a Missing Reference on the other computers.

    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
    Registered User
    Join Date
    05-21-2015
    Location
    Tulsa, OK
    MS-Off Ver
    2010
    Posts
    9

    Re: Compile Error... HELP!!!!!

    We have checked to see if something is missing and found nothing. when they receive the error is highlights the code below and the word "Right".

    Please Login or Register  to view this content.

  4. #4
    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,425

    Re: Compile Error... HELP!!!!!

    There's nothing wrong with the code highlighted, as far as I can see.

    But this is typical of errors generated by missing references.

    I can't really test the code by copying it into an empty worksheet. Can you upload a sample workbook?

    Regards, TMS

  5. #5
    Registered User
    Join Date
    05-21-2015
    Location
    Tulsa, OK
    MS-Off Ver
    2010
    Posts
    9

    Re: Compile Error... HELP!!!!!

    i did have a popup calendar added and removed the code but it was still checked in my "tools --> References". I have unchecked that box and saved my file, could that have been causing the error?

    Thanks

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Compile Error... HELP!!!!!

    title updated
    Last edited by protonLeah; 05-28-2015 at 04:51 PM.
    Ben Van Johnson

  7. #7
    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,425

    Re: Compile Error... HELP!!!!!

    @Cindy: now that Ben has also picked up on your thread title, I can no longer continue with the discussion until you edit it.

  8. #8
    Registered User
    Join Date
    05-21-2015
    Location
    Tulsa, OK
    MS-Off Ver
    2010
    Posts
    9

    Re: Compile Error VBA error code attached

    I have updated my thread title on my original post. sorry for the confusion.

  9. #9
    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,425

    Re: Compile Error VBA error code attached

    I believe that the Calendar Control isn't available in all versions of Excel. If your original code required a specific reference, that may still be present in your copy but be MISSING in your colleague's.

    I would first check for MISSING references and, if found, uncheck them.

    As I said, posting a sample workbook that demonstrates the problem might accelerate diagnosis of the problem.

    Regards, TMS

  10. #10
    Registered User
    Join Date
    05-21-2015
    Location
    Tulsa, OK
    MS-Off Ver
    2010
    Posts
    9

    Re: Compile Error VBA error code attached

    Attached is a test file. If you could also help with when selecting from the incentive type they would appear in separate cells to the right of the multi select box and when selecting an incentive area the tabs previously select disappear.

    TEST.xlsm

    Thanks
    Cindy

  11. #11
    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,425

    Re: Compile Error VBA error code attached

    OK, I've tested the workbook and had no problems. No MISSING references, it seems.

    So, I've made some changes. Removed the three empty User Forms. Removed Module 1 containing a copy of the Worksheet Change event handler. Restructured the Drop down lists worksheet. Created Dynamic Named Ranges (DNRs) for all the lists ... much easier if the lists are in separate columns (and I tend to separate lists with a blank column). And applied the DNRs in the relevant cells on the Summary sheet.

    Everything seems to work as it should, although I have to say I'm not a fan of Application.Undo ... but it does seem to generate multiple entries in the cell (interesting approach).

    So, not sure what else I can say. It seems to work as far as I can see. Though whether it works to your satisfaction, or not, is another matter.


    Regards, TMS
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    05-21-2015
    Location
    Tulsa, OK
    MS-Off Ver
    2010
    Posts
    9

    Re: Compile Error VBA error code attached

    Thank you TMS... just one more question...

    Is there any way to make the items in the multi select boxes to also appear in the cells to the right of that box (individually)? And when i select an "incentive type" it opens up the correct worksheet, but when selecting an "incentive area" the worksheet disappears?

    Thanks again!!!
    Cindy

  13. #13
    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,425

    Re: Compile Error VBA error code attached

    Hi Cindy. Although you have said "thank you", you haven't said whether or not the problem has been resolved.

    As to the additional questions, anything is possible ... but "make the items in the multi select boxes to also appear in the cells to the right of that box (individually)" is not very specific. I'm not sure how you indicate that you want to start the process, that is, clear cell B36 (Incentive Type) and, end it. How do you know whether or not to keep adding Incentive Types? Which leads on to, when and when not to display of hide Incentive sheets. And, is there a limit to how many Incentive Types to be stored in cells? Which cells? When do you clear the stored entries.

    And cell B47 (Incentive Area) is also a multi-selection cell; so when do you hide sheets?

    I think you need to think through the logic and start a new thread with a clear explanation.

    In the meantime, ...


    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  14. #14
    Registered User
    Join Date
    05-21-2015
    Location
    Tulsa, OK
    MS-Off Ver
    2010
    Posts
    9

    Re: Compile Error VBA error code attached

    TMS thank you again and yes it worked i no longer receive the error. I will post my additional questions in a new post.

    thanks
    Cindy

  15. #15
    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,425

    Re: Compile Error VBA error code attached

    You're welcome. Thanks for the rep.

+ 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. Excel macro (compile error. syntax error.) error
    By salar_younis in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2014, 06:11 AM
  2. [SOLVED] Compile Error in Hidden Module and Compile Error: Can't find project or library
    By Taislin in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-10-2013, 07:03 PM
  3. [SOLVED] Compile error: Constant expression required error when merging two Codes
    By Kezwick in forum Outlook Programming / VBA / Macros
    Replies: 8
    Last Post: 06-26-2013, 09:32 AM
  4. compile error: compile error expected
    By odeno in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-11-2008, 04:30 PM
  5. VBAProject name compile error, not defined at compile time
    By Matthew Dodds in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-13-2005, 03:20 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