Question

  Asked: Mar 27 2008   3:13 PM GMT
  Asked by: Tsbarr


Switching custom views in Excel when filtering


Microsoft Excel, Excel 2003, Excel macros, VBA

I have a very large spreadsheet that I navigate using custom views. I change views using macros because I have a couple of other commands that I want executed as well. I also commonly filter the rows of the spreadsheet. However, when I switch views, the filter is turned off, and I would like it to remain filtered as is. Is there a way to stop the filtering from being turned off? Or can I get the setting with a VB command and then reapply it at the end of the macro? Thanks!

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



It sounds like you want to display a custom view, then switch to another custom view while keeping the previous one. In principle that makes no sense. You can't display more than one custom view at a time (someone correct me if I'm wrong, but it doesn't sound right).

Are you trying to layer views? It would just be a third custom view which is a combination of both.

The way I do it is set up the worksheet the way you want it displayed, create the custom view, then record a macro of yourself selecting that view. Then use that code as the basis for a command button.

HTH,
JP
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Microsoft Windows and Development.

Looking for relevant Microsoft Windows Whitepapers? Visit the SearchEnterpriseDesktop.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register

YuvalShavit  |   Mar 27 2008  6:00PM GMT

This is not a very complete answer, but take a look at the VBA AutoFilter object. I believe its getters and setters should be helpful for what you’re trying to do. Sorry I can’t be of more specific help; I haven’t worked with AutoFilter much in VBA.