Hello, I am trying to remove filter from WB1 Sheet3 and WB2 Sheet1. My code is as follows below. My issue here is I can't get WB2 to be activated to sort the data in WB2 Sheet1. My code brings me to WB1 Sheet1 instead. Thank you in advance.
Dim varSheetA As Variant
Dim varSheetB As Variant
Dim wbkA As Variant
Dim wbkB As Variant
Set wbkA = Workbooks.Open(fileName:="WB1")
Set varSheetA = wbkA.Worksheets("Sheet3")
varSheetA.Activate
If (ActiveSheet.AutoFilterMode And ActiveSheet.FilterMode) Or ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If
Set wbkB = Workbooks.Open(fileName:="WB2")
wbkB.Activate
Set varSheetB = wbkB.Worksheets("Sheet1")
varSheetB.Activate
If (ActiveSheet.AutoFilterMode And ActiveSheet.FilterMode) Or ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If
Dim varSheetA As Variant
Dim varSheetB As Variant
Dim wbkA As Variant
Dim wbkB As Variant
Set wbkA = Workbooks.Open(fileName:="WB1")
Set varSheetA = wbkA.Worksheets("Sheet3")
varSheetA.Activate
If (ActiveSheet.AutoFilterMode And ActiveSheet.FilterMode) Or ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If
Set wbkB = Workbooks.Open(fileName:="WB2")
wbkB.Activate
Set varSheetB = wbkB.Worksheets("Sheet1")
varSheetB.Activate
If (ActiveSheet.AutoFilterMode And ActiveSheet.FilterMode) Or ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If