Results 1 to 3 of 3

changing letter case in cell

Threaded View

  1. #1
    Registered User
    Join Date
    04-19-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    40

    changing letter case in cell

    Hi guys, fairly simple one, yet it has me stumped.

    Trying to change my code to add another automatic function in my document. Here is the snippet of code involved:

    'Automatic Date Update/Sheet ordering
    Sub Worksheet_Change(ByVal Target As Range)
    
    Dim updatedDate As Date, rngETA As Range, rngStatus As Range, rngNotes As Range, LRow As Long
    
    'Today's date
    updatedDate = Now()
    
    'Find last row and set ranges
    LRow = Cells(Rows.Count, 1).End(xlUp).Offset(0, 0).Row
    Set rngETA = Range("J2:" & "J" & LRow)
    Set rngStatus = Range("L2:" & "L" & LRow)
    Set rngNotes = Range("M2:" & "M" & LRow)
    
    'Auto date update - on ETA change
    If Not Intersect(Target, rngETA) Is Nothing Then
    If Target.Count > 1 Then Exit Sub
        Target.Offset(, 1).Value = updatedDate
    End If
    
    'Auto date update - on status change
    If Not Intersect(Target, rngStatus) Is Nothing Then
    If Target.Count > 1 Then Exit Sub
        Target.Offset(, -1).Value = updatedDate
    End If
    
    'Auto date update - on note change
    If Not Intersect(Target, rngNotes) Is Nothing Then
    If Target.Count > 1 Then Exit Sub
        Target.Offset(, -2).Value = updatedDate
    End If
    
    'Auto sheet odering by status & debtor name
    Rows("1:" & LRow).Sort Key1:=Cells(2, 12), Key2:=Cells(2, 1), _
    Order1:=xlAscending, Header:=xlYes, _
    OrderCustom:=1, MatchCase:=False, _
    Orientation:=xlTopToBottom
    
    End Sub
    Essentially what I would like to do is if text is entered into range L2:L* (where * is last row- LRow in my code) to have upper case. I have tried:

    'Auto date update - on status change
    If Not Intersect(Target, rngStatus) Is Nothing Then
    If Target.Count > 1 Then Exit Sub
        Target.Value = UCase(Target.Value)
        Target.Offset(, -1).Value = updatedDate
    End If
    However the addition of line

    Target.Value = UCase(Target.Value)

    seems to send the function into a loop and can only be stopped by ESC.

    Please assist me as I really would like to have this function. I know it must be something simple that I am overlooking and your help will be greatly appreciated.
    Last edited by mpower87; 06-09-2010 at 02:44 AM. Reason: solved

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