I have this code that fires when a hyperlink in a cell is clicked. The code then filters data in a table on the page. However after it filters the table, my graphs and other data cells on the page, that are not part of the table being filtered are also loosing data and getting cut off.
Code:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim LastCell As Integer
With Sheets("Days Past Due")
If .AutoFilterMode Then
.ShowAllData
End If
'MABST 1 to 5
If Target.Range.Address = "$B$4" Then
With Sheets("Days Past Due")
LastCell = .Cells(.Rows.Count, "AA").End(xlUp).Row
MsgBox LastCell
ActiveSheet.Range("P3:AA" & LastCell).AutoFilter Field:=12, Criteria1:="<=5"
ActiveSheet.Range("P3:AA" & LastCell).AutoFilter Field:=2, Criteria1:="MABST"
End With
End If