Consulting

Results 1 to 6 of 6

Thread: "Can't find project or library" error

  1. #1
    VBAX Regular
    Joined
    Jun 2019
    Posts
    35
    Location

    "Can't find project or library" error

    Hi all. I've been using the sript below with no issues but it has now decided to pop up the message "Can't find project or library" whenever you enter anything new in any cell in the worksheet - what am I doing wrong?! When I go into the References - VBAProject popup box, MS tells me I should see unresolved references prefixed with MISSING but there aren't any?!



    The code I'm using is:

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Set Target = Range("D1")
    If Target = "" Then Exit Sub
    Application.ActiveSheet.Name = VBA.Left(Target, 31)
    Exit Sub
    End Sub
    Last edited by Aussiebear; 02-01-2022 at 09:50 AM. Reason: Added code tags to supplied code

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,445
    Location
    You probably have an invalid reference.

    Go to the Tools>References menu option in the VBIDE, and you should see an item in error. Just uncheck it.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,715
    Location
    Quote Originally Posted by TraceyH View Post
    Hi all. I've been using the sript below with no issues but it has now decided to pop up the message "Can't find project or library" whenever you enter anything new in any cell in the worksheet - what am I doing wrong?! When I go into the References - VBAProject popup box, MS tells me I should see unresolved references prefixed with MISSING but there aren't any?!
    I've had some otherwise well-behaved VBA intrinsic functions like Left() start throwing that error with nothing amiss in References

    I've usually be able to get rid of it by using AppsPro code cleaner

    http://www.appspro.com/Utilities/CodeCleaner.htm


    There's also a sticky on this

    http://www.vbaexpress.com/forum/show...ect-or-Library
    Last edited by Paul_Hossler; 02-01-2022 at 05:06 AM.
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  4. #4
    VBAX Regular
    Joined
    Jun 2019
    Posts
    35
    Location
    Hiya - thanks for getting back to me, but I've tried that and there are no references marked as MISSING?Screenshot 2022-02-01 134101.jpg

  5. #5
    Banned VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,648
    Me thinks you're using audacious code: Set Target = Range("D1")
    You'd better:

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
      If Target <> "" Then name =left(target,31)
    End Sub
    or
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
      If Target <> "" Then name =left(cells(1,4),31)
    End Sub
    Last edited by snb; 02-01-2022 at 09:09 AM.

  6. #6
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,715
    Location
    Quote Originally Posted by TraceyH View Post
    Hiya - thanks for getting back to me, but I've tried that and there are no references marked as MISSING?
    1. Did you scroll all the way to the botton?

    2. I see a lot of VBAProject lines. Are there other workbooks open?

    3. And of course, there's the always popular "Have you restarted your computer?"
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •