I have a code to import closed workbook sheets into a Master sheet. However, some sheets have filters applied to a column or two. What code do I add to my current code to clear the filter of the closed worksheet when importing to Master sheet.
I tried adding with
and it did not work.
Here's part of my code
I tried adding with
VBA Code:
src.WB.ActiveSheet.ShowAllData
Here's part of my code
Code:
Const strPath As String = "C:\Users\TEST\Desktop\New folder\"
ChDir strPath
strExtension = Dir(strPath & "*.xlsx")
i = 1
Do While strExtension <> ""
Set srcWB = Workbooks.Open(strPath & strExtension)
With srcWB.Sheets(srcWB.Sheets.Count)
LastRow = .Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
If i = 1 Then
.Range("A1").CurrentRegion.Copy desWS.Cells(desWS.Rows.Count, "A").End(xlUp).Offset(1, 0)
numcol = .Range("A1").CurrentRegion.Columns.Count
Else
Set rng = .Range("A1").CurrentRegion
Set rng = rng.Offset(1, 0)
Set rng = rng.Resize(rng.Rows.Count - 1)
rng.Copy desWS.Cells(desWS.Rows.Count, "A").End(xlUp).Offset(1, 0)
End If