Hi MM,
I have managed to fix the flicker issues ( I was calling macros in the wrong places). Please find my code for the sheet sort below.
I am either sorting by Column A or Column K, but should not sort Column K unless Column A has a value. I have tried the sort criteria as both ="" and ="=".
Sub DoFilters()
Application.ScreenUpdating = False
Application.EnableEvents = False
Dim w As Worksheet, RLetter As String
Dim Crit As String
Crit = Sheets("TOTALS").Range("DateRange").Value
RLetter = Crit
For Each w In Worksheets
If w.Index > 2 Then
If RLetter = "Year To Date" And w.AutoFilterMode Then
w.Unprotect Password:="test"
w.AutoFilterMode = False
w.Protect Password:="test", DrawingObjects:=True, Contents:=True, Scenarios:=True
ElseIf RLetter = "Uninvoiced" And w.AutoFilterMode Then
w.Unprotect Password:="test"
w.Columns("K").AutoFilter Field:=1, Criteria1:="", Visibledropdown:=True
w.Protect Password:="test", DrawingObjects:=True, Contents:=True, Scenarios:=True
''w.Range("A1").SpecialCells(xlCellTypeLastCell).AutoFilter Field:=11, Criteria1:="="
Else
w.Unprotect Password:="test"
w.Range("A1").End(xlDown).AutoFilter Field:=1, Criteria1:=Crit, Visibledropdown:=True
w.Protect Password:="test", DrawingObjects:=True, Contents:=True, Scenarios:=True
On Error Resume Next
End If
'w.Protect Password:="test", DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
Next
Application.EnableEvents = True
Application.ScreenUpdating = True
Call Refresh_Click
End Sub
The section "Uninvoiced" is the one I am having issues with.
All help is appreciated.
Cheers
Adam
Bookmarks