Ucase advice for two ranges on same worksheet

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Hi,
I am using the code below which works fine.
It currently changes the text to Upper Case for the range A1:A38

On the same worksheet i also want to use the same code for S4:S38

What i DONT want to do is just change the existing to A1:S38

So Please advise how i apply the code so its like A1:A38 & also S4:S38

Thanks

Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count > 1 Or Target.HasFormula Then Exit Sub

On Error Resume Next

If Not Intersect(Target, Range("A1:A38")) Is Nothing Then
Application.EnableEvents = False
Target = UCase(Target)
Application.EnableEvents = True

End If
On Error GoTo 0

End Sub
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Try this:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified  7/10/2022  9:10:01 AM  EDT
If Target.Column = 1 And Target.Row < 39 Then
    Application.EnableEvents = False
    Target = UCase(Target)
Application.EnableEvents = True
End If

If Target.Column = 19 And Target.Row > 3 And Target.Row < 39 Then
    Application.EnableEvents = False
    Target = UCase(Target)
Application.EnableEvents = True
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,006
Messages
6,122,665
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top