I have a sheet in which I would like to change the case of any data entered, but only in certain blocks. I found this piece of code which works well, but only for a single block of data.
Dim ProcessingUCChange As Boolean
Private Sub Worksheet_Change(ByVal Target As Range)
If ProcessingUCChange Then
Exit Sub
End If
ProcessingUCChange = True
Dim rng As Range
Set rng = Range("A:A")
On Error GoTo Err
For Each c In Target.Cells
If Not Intersect(c, rng) Is Nothing Then
c.Value = UCase(c.Value)
End If
Next
Err:
ProcessingUCChange = False
End Sub
Can anyone advise me how to change it so that it can handle multiple blocks of data?
Dim ProcessingUCChange As Boolean
Private Sub Worksheet_Change(ByVal Target As Range)
If ProcessingUCChange Then
Exit Sub
End If
ProcessingUCChange = True
Dim rng As Range
Set rng = Range("A:A")
On Error GoTo Err
For Each c In Target.Cells
If Not Intersect(c, rng) Is Nothing Then
c.Value = UCase(c.Value)
End If
Next
Err:
ProcessingUCChange = False
End Sub
Can anyone advise me how to change it so that it can handle multiple blocks of data?