Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default looking for autofilter with code


Tom Ogilvy Wrote:
It is unclear who you are responding to, but if you are responding t
me, I
used neither of those constructs. The code I posted will work.


sorry, i was unclear:

I copied and pasted your code and got "object variable or with bloc
variable not set". I figured you meant to add in f = Filter so I adde
that as the third line, but then it errored for "argument not optional"

--
lcorey
-----------------------------------------------------------------------
lcoreyl's Profile: http://www.excelforum.com/member.php...nfo&userid=204
View this thread: http://www.excelforum.com/showthread.php?threadid=26232

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default looking for autofilter with code

I copied this out of a module where it worked very well: (just for
illustration - built around the code I posted).

Sub CheckFilters()
Dim w As Worksheet, f As Filter
Set w = ActiveSheet
If w.AutoFilterMode = False Then
MsgBox "Autofilter not in effect"
Exit Sub
End If
i = 0
For Each f In w.AutoFilter.Filters
i = i + 1
If f.On Then
MsgBox "filter in cell " & _
w.AutoFilter.Range(1, i).Address & _
" is on"
End If
Next
End Sub

Again, whatever changes you made were not required and the lines you show
(your own creation) are incorrect.

--
Regards,
Tom Ogilvy

"lcoreyl" wrote in message
...

Tom Ogilvy Wrote:
It is unclear who you are responding to, but if you are responding to
me, I
used neither of those constructs. The code I posted will work.


sorry, i was unclear:

I copied and pasted your code and got "object variable or with block
variable not set". I figured you meant to add in f = Filter so I added
that as the third line, but then it errored for "argument not optional".


--
lcoreyl
------------------------------------------------------------------------
lcoreyl's Profile:

http://www.excelforum.com/member.php...fo&userid=2042
View this thread: http://www.excelforum.com/showthread...hreadid=262326



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
vba code on autofilter ub Excel Discussion (Misc queries) 1 August 6th 08 08:09 PM
Autofilter code Dominic LeVasseur Excel Discussion (Misc queries) 2 August 16th 06 09:33 PM
looking for autofilter with code lcoreyl[_14_] Excel Programming 1 September 24th 04 02:37 AM
looking for autofilter with code lcoreyl[_13_] Excel Programming 0 September 23rd 04 12:57 AM
looking for autofilter with code lcoreyl[_12_] Excel Programming 3 September 22nd 04 02:36 PM


All times are GMT +1. The time now is 12:14 AM.

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

About Us

"It's about Microsoft Excel"