ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to save current filter of Table(ListObject) and to apply it la (https://www.excelbanter.com/excel-programming/420264-how-save-current-filter-table-listobject-apply-la.html)

Smugliy

How to save current filter of Table(ListObject) and to apply it la
 
Hi , I am new in Excel Programming .I have following question:
I have an object
Excel.ListObject lo = _currentWS.ListObjects[1];
lo.AutoFilter contains current filter which user activated(for example,
top10, contains ,greater than ... ).

I need to perform
lo.AutoFilter.ShowAllData();
In this case user filter disappear.
What I need to do for saving current filter and applying it after.
Thanks a lot


JLGWhiz

How to save current filter of Table(ListObject) and to apply it la
 
Sub SetFiltRngToVar()
Rng = Sheets(1).UsedRange.SpecialCells(xlCellTypeVisible ).Address
MsgBox Rng
End Sub

"Smugliy" wrote:

Hi , I am new in Excel Programming .I have following question:
I have an object
Excel.ListObject lo = _currentWS.ListObjects[1];
lo.AutoFilter contains current filter which user activated(for example,
top10, contains ,greater than ... ).

I need to perform
lo.AutoFilter.ShowAllData();
In this case user filter disappear.
What I need to do for saving current filter and applying it after.
Thanks a lot


Smugliy

How to save current filter of Table(ListObject) and to apply i
 
Sorry,JLGWhiz
How this function helps me ?Its stores filter of table?
How can I apply it from Rng?

"JLGWhiz" wrote:

Sub SetFiltRngToVar()
Rng = Sheets(1).UsedRange.SpecialCells(xlCellTypeVisible ).Address
MsgBox Rng
End Sub

"Smugliy" wrote:

Hi , I am new in Excel Programming .I have following question:
I have an object
Excel.ListObject lo = _currentWS.ListObjects[1];
lo.AutoFilter contains current filter which user activated(for example,
top10, contains ,greater than ... ).

I need to perform
lo.AutoFilter.ShowAllData();
In this case user filter disappear.
What I need to do for saving current filter and applying it after.
Thanks a lot


JLGWhiz

How to save current filter of Table(ListObject) and to apply i
 
The variable Rng contains the string address of the filtered items, so you
would use it like the "&A$1" in Range("$A$1"), only without the quote marks.

ActiveSheet.Range(Rng).Copy Sheets(2).Range("A2")

would copy the filtered data to sheet 2, with the top left corner of the
range achored in cell A2.

"Smugliy" wrote:

Sorry,JLGWhiz
How this function helps me ?Its stores filter of table?
How can I apply it from Rng?

"JLGWhiz" wrote:

Sub SetFiltRngToVar()
Rng = Sheets(1).UsedRange.SpecialCells(xlCellTypeVisible ).Address
MsgBox Rng
End Sub

"Smugliy" wrote:

Hi , I am new in Excel Programming .I have following question:
I have an object
Excel.ListObject lo = _currentWS.ListObjects[1];
lo.AutoFilter contains current filter which user activated(for example,
top10, contains ,greater than ... ).

I need to perform
lo.AutoFilter.ShowAllData();
In this case user filter disappear.
What I need to do for saving current filter and applying it after.
Thanks a lot


Smugliy

How to save current filter of Table(ListObject) and to apply i
 
I think you didn't understand me correctly.

I want to apply the same filter on the Table .
It's mean user created some filter on table, I need to save this filter and
apply it later on the same table.
I don't want to copy range from one sheet to another

"JLGWhiz" wrote:

The variable Rng contains the string address of the filtered items, so you
would use it like the "&A$1" in Range("$A$1"), only without the quote marks.

ActiveSheet.Range(Rng).Copy Sheets(2).Range("A2")

would copy the filtered data to sheet 2, with the top left corner of the
range achored in cell A2.

"Smugliy" wrote:

Sorry,JLGWhiz
How this function helps me ?Its stores filter of table?
How can I apply it from Rng?

"JLGWhiz" wrote:

Sub SetFiltRngToVar()
Rng = Sheets(1).UsedRange.SpecialCells(xlCellTypeVisible ).Address
MsgBox Rng
End Sub

"Smugliy" wrote:

Hi , I am new in Excel Programming .I have following question:
I have an object
Excel.ListObject lo = _currentWS.ListObjects[1];
lo.AutoFilter contains current filter which user activated(for example,
top10, contains ,greater than ... ).

I need to perform
lo.AutoFilter.ShowAllData();
In this case user filter disappear.
What I need to do for saving current filter and applying it after.
Thanks a lot



All times are GMT +1. The time now is 03:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com