I implemented the following VB code to my excel sheet where I want all input within multiple ranges forced to capital letters.
Code is as follows:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not (Application.Intersect(Target, Range("E9:CQ19, E22:CQ32, E35:C45")) Is Nothing) Then
With Target
If (Not .HasFormula) And (.Count = 1) Then
.Value = UCase(.Value)
End If
End With
End If
End Sub
It worked until i selected multiple cells to "Clear Contents" which gave me my first run time error.
I changed the line of code .Value = UCase(.Value) to Target = UCase(Target.Cells(1) which fixed that and now I have another problem.
When I select a cell to just delete the info from and return a blank cell, i get a new run time error. The current code is as follows.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not (Application.Intersect(Target, Range("E9:CQ19, E22:CQ32, E35:C45")) Is Nothing) Then
With Target
If (Not .HasFormula) And (.Count = 1) Then
Target = UCase(Target.Cells(1))
End If
End With
End If
End Sub
Any thoughts as to how to fix a run time error when i select a cell and just delete the contents?
Code is as follows:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not (Application.Intersect(Target, Range("E9:CQ19, E22:CQ32, E35:C45")) Is Nothing) Then
With Target
If (Not .HasFormula) And (.Count = 1) Then
.Value = UCase(.Value)
End If
End With
End If
End Sub
It worked until i selected multiple cells to "Clear Contents" which gave me my first run time error.
I changed the line of code .Value = UCase(.Value) to Target = UCase(Target.Cells(1) which fixed that and now I have another problem.
When I select a cell to just delete the info from and return a blank cell, i get a new run time error. The current code is as follows.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not (Application.Intersect(Target, Range("E9:CQ19, E22:CQ32, E35:C45")) Is Nothing) Then
With Target
If (Not .HasFormula) And (.Count = 1) Then
Target = UCase(Target.Cells(1))
End If
End With
End If
End Sub
Any thoughts as to how to fix a run time error when i select a cell and just delete the contents?