Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA to set which columns in Autofilter

Hello,
I have put code my worksheet_activate to automatically turn on th
Autofilter:

If Not AutoFilterMode Then Cells.AutoFilter

Is there a way to set it to only turn the autofilter on for certai
columns? I need to filter columns A and C:F.

Also, in this code, can I set which row to put the Autofilter on?

Thanks!
Mik

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA to set which columns in Autofilter

If Activesheet.AutoFilterMode Then Cells.AutoFilter
Range("A5").CurrentRegion.Resize(,6).AutoFilter _
Field:=3, Criteria1:="F"

I don't think you can skip columns, but I am not sure what would be the
point.

The autofilter filters the entire row, so if a row is hidden, it is hidden
all the way across.

--
Regards,
Tom Ogilvy



miker1999 wrote in message
...
Hello,
I have put code my worksheet_activate to automatically turn on the
Autofilter:

If Not AutoFilterMode Then Cells.AutoFilter

Is there a way to set it to only turn the autofilter on for certain
columns? I need to filter columns A and C:F.

Also, in this code, can I set which row to put the Autofilter on?

Thanks!
Mike


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default VBA to set which columns in Autofilter

You can hide the autofilter arrow with something like:

ActiveSheet.AutoFilter.Range.Columns(2).AutoFilter field:=2, _
visibledropdown:=False

(Assumes the filter is already in place starting in column A.)

"miker1999 <" wrote:

Hello,
I have put code my worksheet_activate to automatically turn on the
Autofilter:

If Not AutoFilterMode Then Cells.AutoFilter

Is there a way to set it to only turn the autofilter on for certain
columns? I need to filter columns A and C:F.

Also, in this code, can I set which row to put the Autofilter on?

Thanks!
Mike

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you Create an Autofilter that goes over 2 columns at the same Abdul Excel Discussion (Misc queries) 1 November 11th 08 04:50 AM
AUTOFILTER-2 non-adjacent columns GaryW New Users to Excel 3 May 21st 08 10:54 PM
autofilter on many columns inquirer Excel Discussion (Misc queries) 3 July 16th 06 04:32 AM
Autofilter - on select columns rudawg Excel Worksheet Functions 8 January 31st 06 06:20 AM
Is there a way I can autofilter columns instead of rows Brian A. Excel Worksheet Functions 0 October 27th 05 03:15 PM


All times are GMT +1. The time now is 09:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"