Thanks xlbiznes but I need a different range to be auto upper case. I have a workbook with only this code and it works great:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
If Target.Cells.Count > 1 Or Target.HasFormula Then Exit Sub
Application.EnableEvents = False
Set rng = Union([B1], [A28:K42,J12:J22], [G:G]) 'Upper Case
If Not Intersect(Target, rng) Is Nothing Then
Target = UCase(Target)
End If
Application.EnableEvents = True
End Sub
I also have a workbook with code to bold/unbold a range of 31 numbers that represent a month. It also counts the number of bold numbers and tallies them in a separate cell. The part of the code that runs the bold and count works great but the auto upper case doesn't work in this workbook and is as follows:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("B7:I10")) Is Nothing Then
'If the target cell is not bold
If Target.Font.Bold = False Then
'Then change the font to bold
Target.Font.Bold = True
'But if the target cell is already bold
ElseIf Target.Font.Bold = True Then
'Then change the font to not bold
Target.Font.Bold = False
End If
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim x As Long
Dim rcell As Range
If Not Intersect(Target, Range("B7:I10")) Is Nothing Then
For Each rcell In Range("B7:I10")
If rcell.Font.Bold = True Then x = x + 1
Next rcell
Range("J7").Value = x
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
If Target.Cells.Count > 1 Or Target.HasFormula Then Exit Sub
Application.EnableEvents = False
Set rng = Union([B1], [A28:K42,J12:J22], [G:G]) 'Upper Case
If Not Intersect(Target, rng) Is Nothing Then
Target = UCase(Target)
End If
Application.EnableEvents = True
End Sub
Again, thanks for the help
Bookmarks