Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

VBA AutoFilter question

  Asked By: Chisisi    Date: Nov 24    Category: MS Office    Views: 1067
  

I have a listing with Autofilter permanently on.

I have developed a series of buttons with macros attached and
positioned above the respective columns to sort the list in ascending
order for that particular column. (Do not want to use the menu sort
buttons).

However, sorting by these macro buttons, switches off the Autofilter.
The active range starts in Cell "A6" on the "PhoneList" sheet.

How can I ensure that the AutoFilter remains switched on and showing
all records.

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Wallace Kelly     Answered On: Nov 24

Try this: In each of your sort  macros, turn AutoFilter mode off before sorting,
then turn it back on afterward. Don't know why, but when I experimented with it,
that worked.

Sub SortMacro1()
'Turn AutoFilter mode off
ActiveSheet.AutoFilterMode = False
'Your Sort routine
Range("A6:I15").Sort Key1:=Range("B6"), Order1:=xlAscending, Header:=xlGuess
'Go to A6 and turn AutoFilter mode back on
Range("A6").Select
Selection.AutoFilter
End Sub

 
Answer #2    Answered By: Zack Thompson     Answered On: Nov 24

I was working all the way round Autofiltermode, but without the (obvious
now) process of switching off before the sort  & switching back on
afterwards.

 
Answer #3    Answered By: Krista Warren     Answered On: Nov 24

I've tried this with my own coding and autofiltering isn't switched
off! Could you post your existing code?

 
Didn't find what you were looking for? Find more on VBA AutoFilter question Or get search suggestion and latest updates.




Tagged: