Hi, I am new to VBA and require some help.
I am able to lock cells for a certain range (below):
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xRg As Range
On Error Resume Next
Set xRg = Intersect(Range("A1:A10,C1:C10,E1:E10"), Target)
If xRg Is Nothing Then Exit Sub
Target.Worksheet.Unprotect Password:="0"
If xRg.Value <> mStr Then xRg.Locked = True
Target.Worksheet.Protect Password:="0"
End Sub
And also make certain cells to force uppercase on them (below):
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim rngCell As Range
If Intersect(Target, Range("B1:B1O,D1,F1")) Is Nothing Then Exit Sub
Application.EnableEvents = False
For Each rngCell In Target.Cells
rngCell = UCase(rngCell)
Next
Application.EnableEvents = True
End Sub
And I learnt that there cannot be duplicates of Worksheet_Change but i am having difficulties on how to combine them together. Kindly advise on how to combine them both.
Have attached the excel document on what i have done also.
Thank you.
Bookmarks