Hi,
I am using this code to auto filter across different sheets.
Could someone help make it more efficient please?
I am using this code to auto filter across different sheets.
Could someone help make it more efficient please?
Code:
[/COLOR][COLOR=#333333]Private Sub Worksheet_Change(ByVal Target As Range)[/COLOR]
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">'
On Error Resume Next
If Not Intersect(Range("B1"), Target) Is Nothing Then
Application.EnableEvents = False
If Range("B1").Value = "" Then
For Each Worksheet In ThisWorkbook.Worksheets
On Error Resume Next
If Worksheet.AutoFilterMode Then
Worksheet.AutoFilterMode = False
End If
Next Worksheet
Else
Worksheets("Debtors").Range("A3").autofilter 2, Range("B1").Value
Worksheets("Sales Invoices").Range("A3").autofilter 2, Range("B1").Value
Worksheets("Accrued Income").Range("A3").autofilter 2, Range("B1").Value
Worksheets("Accrued Grants").Range("A3").autofilter 2, Range("B1").Value
Worksheets("Prepayments").Range("A3").autofilter 2, Range("B1").Value
Worksheets("GRNI").Range("A3").autofilter 2, Range("B1").Value
Worksheets("Accrued Expense").Range("A3").autofilter 2, Range("B1").Value
Worksheets("Losses").Range("A3").autofilter 2, Range("B1").Value
Worksheets("Special Payments").Range("A3").autofilter 2, Range("B1").Value
Worksheets("Provisions").Range("A3").autofilter 2, Range("B1").Value
Worksheets("Contingent Liabilities").Range("A3").autofilter 2, Range("B1").Value
Worksheets("Cap Commitments").Range("A3").autofilter 2, Range("B1").Value
Worksheets("Rev Commitments").Range("A6").autofilter 2, Range("B1").Value
Worksheets("Asset Additions").Range("A3").autofilter 2, Range("B1").Value
Worksheets("Assets Held For Sale").Range("A3").autofilter 2, Range("B1").Value
End If
Application.EnableEvents = True
End If </code>[COLOR=#333333]End Sub[/COLOR][COLOR=#333333]