ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,737
- Office Version
- 2007
- Platform
- Windows
Morning,
I have the been trying to add a sort code into the existing code but keep getting error messages of which i cant overcome.
Below is the code in use which keeps given me the End if without block if error.
Have a nice day.
I have the been trying to add a sort code into the existing code but keep getting error messages of which i cant overcome.
Below is the code in use which keeps given me the End if without block if error.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range
Application.EnableEvents = False
If Target.Address = "$A$6" Then
With Sheets("INFO").Range("CG2")
If Len(.Offset(1).Value) Then
Set r = .End(xlDown).Offset(1)
With .End(xlDown).Offset(1)
.Value = UCase$(ActiveSheet.Cells(6, 1).Value)
.Interior.ColorIndex = 6
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.VerticalAlignment = xlCenter
.Borders.LineStyle = xlContinuous
.RowHeight = 19.5
.Font.Bold = True
With ActiveWorkbook.Worksheets("INFO").Sort
.SetRange Range("CG2:CG500")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End If
End With
End If
With Target
If .Column <> 13 And .Count = 1 And Not .HasFormula Then
Application.EnableEvents = False
.Value = UCase$(.Value)
Application.EnableEvents = True
End If
End With
Application.EnableEvents = True
End Sub
Have a nice day.