Hey all,
The below excel macro filters and sorts data BUT when I try to export the file, all the hidden cells return, even though I want the hidden cells destroyed:
Sub Sortarific()
'
' Sort and Filter
'
'
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$E$429"), , xlNo).Name = _
"Table1"
Range("Table1[#All]").Select
ActiveSheet.ListObjects("Table1").TableStyle = "TableStyleLight1"
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=1, Criteria1:= _
"=Real Prop*", Operator:=xlAnd
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=2, Criteria1:= _
"=DF*", Operator:=xlAnd
ActiveWorkbook.ActiveSheet.ListObjects("Table1").Sort. _
SortFields.Clear
ActiveWorkbook.ActiveSheet.ListObjects("Table1").Sort. _
SortFields.Add Key:=Range("Table1[[#All],[Column5]]"), SortOn:= _
xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.ActiveSheet.ListObjects("Table1"). _
Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Columns("A:B").Select
Selection.EntireColumn.Hidden = True
Rows("1:1").Select
Range("Table1[[#Headers],[Column3]]").Activate
Selection.EntireRow.Hidden = True
End Sub
Is there a way where I can sort and filter similarly in Access but not have the issue where all the filtered fields remain when I try to export the data or perform a query against other data sets without having to worry that the filtered criteria will make its presence again?
Thanks for response.
Bookmarks