Share via

UCase problem

Anonymous
2010-12-31T17:58:27+00:00

I have the following Sub that works on some computers but not on others. I get a Compile error "Can't find project or library" and hi lites UCase

Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False

If Not Intersect(Target, Range("F9,C70,C71,B127,B130,C178,ID606")) Is Nothing Then

Target.Value = UCase(Target.Value)

End If

Application.EnableEvents = True

End Sub

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2010-12-31T18:08:39+00:00

If other VB functions work, but that one doesn't (which I am assuming is the case), it usually means there is something out there somewhere (variable, subroutine name, etc.) with that same name. While it would be best to track that down and change it so it avoids the conflict, you should be able to circumvent the problem by changing that line of code to this...

Target.Value = VBA.UCase(Target.Value)


NOTE: Please mark the message or messages (yes, you can mark more than one) that answer your question as the "Answer" so that others will know your question has been resolved.

Was this answer helpful?

40+ people found this answer helpful.
0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2010-12-31T18:20:52+00:00

    In the VBE, go to Tools > References. In the dialog, you will probably see a reference marked as "MISSING". Resolve that missing reference - just uncheck it if it's not needed - and you should then find all is well (with the UCase, although not necessarily with other things - it depends what it was that was missing).


    Enjoy,

    Tony

    www.WordArticles.com

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2015-03-03T01:41:54+00:00

    Hi Rick,

    Just came across this, this resolved my problem.  Brilliant answer, save me a lot of time.  Many thanks

    regards

    Dave

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2010-12-31T19:29:00+00:00

    All computers have the same references Rick Rothstein, MVP - Excel<abbr class="affil" style="outline-width: 0px; outline-style: initial; outline-color: initial; font-weight: inherit; font-style: inherit; font-family: inherit; padding: 0px; margin: 0px; border: 0px initial initial;"> </abbr>Answered the question.

    Thanks for the reply

    oldjay .

    Was this answer helpful?

    0 comments No comments