+ Reply to Thread
Results 1 to 6 of 6

VBA code quit working

Hybrid View

  1. #1
    Registered User
    Join Date
    06-28-2011
    Location
    Birmingham, AL
    MS-Off Ver
    Excel 2007
    Posts
    3

    VBA code quit working

    I've been using this "forced upper case" code for the last 3 months and haven't had any problems out of it.

    Now, it won't run.

    I did set up the workbook to track changes, which shared the workbook. I went back and took off tracked changes and un-shared it, but I'm still getting nothing.

    What am I missing?

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim tmpRng As Range, cl As Range
    Set tmpRng = Intersect(Me.Range("a5:z1000"), Target)
    If tmpRng Is Nothing Then Exit Sub
    With Application
        .ScreenUpdating = False
        .EnableEvents = False
    End With
    For Each cl In tmpRng
        With cl
            If VarType(.Value) = vbString Then _
                .Value = UCase$(.Value)
        End With
    Next
    With Application
        .ScreenUpdating = True
        .EnableEvents = True
    End With
    Set tmpRng = Nothing
    End Sub

  2. #2
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: VBA code quit working

    Hi,

    Is it possible the events were turned to False Try this then save and reopen?

    Sub okon()
    Application.EnableEvents = True
    End Sub
    Thank You, Mike

    Some Helpful Hints:

    1. New members please read & follow the Forum Rules
    2. Use Code Tags...Place[code]Before the first line and[/code] After the last line.
    3. If you are pleased with a solution mark your post SOLVED.
    4. Thank those who have help you by clicking the scales at the top right of the post.

    Here...

  3. #3
    Registered User
    Join Date
    06-28-2011
    Location
    Birmingham, AL
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: VBA code quit working

    Mike, it worked perfectly. Thanks.

    BSG

  4. #4
    Registered User
    Join Date
    06-28-2011
    Location
    Birmingham, AL
    MS-Off Ver
    Excel 2007
    Posts
    3

    Talking Solved

    How to I mark the displayed subject as SOLVED?

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: VBA code quit working

    or
    Private Sub Worksheet_Change(ByVal Target As Range)
      On Error GoTo xl90
      Application.ScreenUpdating = False
      Application.EnableEvents = False
      
      For Each cl In Intersect(Me.Range("a5:z1000").SpecialCells(2, 2), Target)
         cl = UCase(cl)
      Next
      
    xl90:
      Application.EnableEvents = True
    End Sub



  6. #6
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: VBA code quit working

    Hi,

    Glad to help...

    Here is how to mark your post solved

    Click the Edit button on your first post in the thread
    Click Go Advanced
    Select [SOLVED] from the dropdown
    Then click Save Changes.


+ 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