How to save current filter of Table(ListObject) and to apply it la

S

Smugliy

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
 
J

JLGWhiz

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

Smugliy

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

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

Smugliy said:
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
 
J

JLGWhiz

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 said:
Sorry,JLGWhiz
How this function helps me ?Its stores filter of table?
How can I apply it from Rng?

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

Smugliy said:
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
 
S

Smugliy

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 said:
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 said:
Sorry,JLGWhiz
How this function helps me ?Its stores filter of table?
How can I apply it from Rng?

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

:

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top