Jagat Pavasia
Active Member
- Joined
- Mar 9, 2015
- Messages
- 406
- Office Version
- 2021
- Platform
- Windows
dear sir,
I have VBA code in my excel file and it is working as i want.
Now I want to add vba to all word capital in my B6:B5000, something like Target = UCase(t)
Please add this vba code in below exiting VBA,
I am a new in Excel VBA code user.
The exiting VBA code is Below :
I have VBA code in my excel file and it is working as i want.
Now I want to add vba to all word capital in my B6:B5000, something like Target = UCase(t)
Please add this vba code in below exiting VBA,
I am a new in Excel VBA code user.
The exiting VBA code is Below :
VBA Code:
Private Sub ComboBox1_Change()
ActiveSheet.Range("C1").Select
ActiveSheet.Range("C2").Select
End Sub
Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Selection.Row >= 6 Then
Set rng1 = Range(Cells(Selection.Row, 1), Cells(Selection.Row, 7))
Set rng2 = Range(Cells(Selection.Row, 10), Cells(Selection.Row, 12))
Set rng = Union(rng1, rng2)
Static xRow
If xRow <> "" Then
Range(Cells(xRow, 1), Cells(xRow, 7)).Interior.ColorIndex = xlNone
Range(Cells(xRow, 10), Cells(xRow, 12)).Interior.ColorIndex = xlNone
End If
prow = Selection.Row
xRow = prow
With rng.Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
Else
If xRow <> "" Then
Range(Cells(xRow, 1), Cells(xRow, 7)).Interior.ColorIndex = xlNone
Range(Cells(xRow, 10), Cells(xRow, 12)).Interior.ColorIndex = xlNone
End If
End If
End Sub
Private Sub worksheet_change(ByVal Target As Range)
Dim rng As Range
If Target.Count > 1 Then Exit Sub
Application.EnableEvents = False
ActiveSheet.Unprotect
Set rng = Range("C:C,J:J")
If Not Intersect(Target, rng) Is Nothing Then
If Target.Value = "**" Then Target.Value = Format(Date, "mm/dd/yyyy")
End If
If Not Intersect(Target, Range("A4:O4")) Is Nothing Then
If Target.Value = "" Then
ActiveSheet.Range("A6:O6").AutoFilter Field:=Target.Column
Else
ActiveSheet.Range("A6:O6").AutoFilter Field:=Target.Column, Operator:=xlFilterValues, Criteria1:=CStr(Target.Value)
End If
End If
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFiltering:=True
Application.EnableEvents = True
End Sub
Last edited by a moderator: