We used this VBA code mainly to hide blank rows and unhide non-blank rows. After that, the second code sorts the rows by a defined column value once the worksheet activates. This process takes too much time with this code.Could anyone help me optimize this code and make it faster? (The worksheet contain an average of 500 rows).Private Sub Worksheet_Activate()HideRowsSortingriskEnd SubSub HideRows()Dim rRange As Range, rCell As RangeDim strVal As String   Set rRange = Worksheets(12).Range(A10:A500)    For Each rCell In rRange      strVal = rCell      rCell.EntireRow.Hidden = strVal = vbNullString    Next rCellEnd SubSub Sortingrisk()    ActiveWorkbook.Worksheets(Control Implementation Plan).AutoFilter.Sort. _      SortFields.Clear   ActiveWorkbook.Worksheets(Control Implementation Plan).AutoFilter.Sort. _      SortFields.Add Key:=Range(G10:G1000), SortOn:=xlSortOnValues, Order:= _      xlDescending, DataOption:=xlSortNormal   With ActiveWorkbook.Worksheets(Control Implementation Plan).AutoFilter.Sort     .Header = xlYes      .MatchCase = False       .Orientation = xlTopToBottom       .SortMethod = xlPinYin       .Apply    End WithEnd Sub
Hide and un-hide rows then sort on Worksheet_Activate event
performance;vba