I have the following code which works fine except that sometimes I have been filtering the lists of data on some pages so when the code copies through to my overview sheet it misses some of the data.
What I am after is a way to automatically clear all filters from all pages (inc overview) when I select the overview sheet.
Option Explicit
Private Sub Worksheet_Activate()
Dim ws As Worksheet, LR As Long
Application.ScreenUpdating = False
Range("A2:M" & Rows.Count).ClearContents
For Each ws In Worksheets
If ws.Name <> Me.Name Then
LR = ws.Range("A" & Rows.Count).End(xlUp).Row
If LR > 1 Then
ws.Range("A2:M" & LR).Copy
Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
End If
End If
Next ws
Columns("A:K").Select
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("Overview").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Overview").Sort.SortFields.Add Key:=Range("A1"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Overview").Sort
.SetRange Range("A2:M" & Rows.Count)
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Cells.Columns.AutoFit
Columns("G:H").Select
Selection.EntireColumn.Hidden = True
Application.ScreenUpdating = True
End Sub
Any help will be much appreciated as ever.
Andrew
Bookmarks