Hi, I want to rename my Sheet1 to PythonAI and Sheet2 to WebDev
Can you edit the code below for me to not have an error. Thanks!
Can you edit the code below for me to not have an error. Thanks!
VBA Code:
Private Sub Worksheet_Activate()
Dim LR As Long
LR = ActiveSheet.Cells(1, 1).CurrentRegion.Rows.Count
Range("A2:C" & LR).Select
Selection.AutoFilter
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Add Key:=Range _
("B2"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Selection.AutoFilter
Range("C2").Select
ActiveCell.Formula = "=RANK.AVG(B2,$B$2:$B$28,0)"
Range("C2").Select
Selection.AutoFill Destination:=Range("C2:C" & LR), Type:=xlFillnormal
Range("C2:C" & LR).Select
Range("C2").Select
End Sub
Last edited by a moderator: