Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Macro help required

I have set up my filters(datafilterauto filter)
Now I want a macro that will do the following:
By invoking the macro it will
1. Show only the blank cells on any given selected col
and by invoking the same macro will display ALL the entries in a selected
col

Would appreciate some help
Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Macro help required

Hi, adapt the following....
where the filter is set to range A1:A5, the Field number relate to the
column# of the filtered column and the criteria the filter value.
The first use of autofilter turns it on (be careful if it is on, it turns
off!) and, the second filters blanks only, and the last resets the criteria
to ALL.


Sub Filter()
With Range("A1:A5")
.Autofilter
.AutoFilter Field:=1, Criteria1:="="
.AutoFilter Field:=1
End With
End Sub

--
Cheers
Nigel



"Ian Macfarlane" wrote in message
...
I have set up my filters(datafilterauto filter)
Now I want a macro that will do the following:
By invoking the macro it will
1. Show only the blank cells on any given selected col
and by invoking the same macro will display ALL the entries in a selected
col

Would appreciate some help
Thanks




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Macro help required

Hi
Thnaks for the help....but
I implemented your code.
Running the code did place the filter in place...but that is all
Further running of the code did nothing.
If I cliked on the filter arrow and select "Blanks" all was well THEN if I
ran the code again, ALL the entries would show.
But I never could get the BLANKS only to show
any ideas?
Thansks for your help so far

"Nigel" wrote in message
...
Hi, adapt the following....
where the filter is set to range A1:A5, the Field number relate to the
column# of the filtered column and the criteria the filter value.
The first use of autofilter turns it on (be careful if it is on, it turns
off!) and, the second filters blanks only, and the last resets the
criteria
to ALL.


Sub Filter()
With Range("A1:A5")
.Autofilter
.AutoFilter Field:=1, Criteria1:="="
.AutoFilter Field:=1
End With
End Sub

--
Cheers
Nigel



"Ian Macfarlane" wrote in message
...
I have set up my filters(datafilterauto filter)
Now I want a macro that will do the following:
By invoking the macro it will
1. Show only the blank cells on any given selected col
and by invoking the same macro will display ALL the entries in a selected
col

Would appreciate some help
Thanks






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro help required

possibly what you want to toggle between all and blanks

Sub Filter()
With Range("A1")
if activesheet.AutofilterMode = False then
.Autofilter
end if
if Activesheet.FilterMode = False then
.AutoFilter Field:=1, Criteria1:="="
Else
.AutoFilter Field:=1
End If
End With
End Sub

Assumes Headers start in Cell A1.


--
Regards,
Tom Ogilvy


"PCOR" wrote in message
...
Hi
Thnaks for the help....but
I implemented your code.
Running the code did place the filter in place...but that is all
Further running of the code did nothing.
If I cliked on the filter arrow and select "Blanks" all was well THEN if I
ran the code again, ALL the entries would show.
But I never could get the BLANKS only to show
any ideas?
Thansks for your help so far

"Nigel" wrote in message
...
Hi, adapt the following....
where the filter is set to range A1:A5, the Field number relate to the
column# of the filtered column and the criteria the filter value.
The first use of autofilter turns it on (be careful if it is on, it

turns
off!) and, the second filters blanks only, and the last resets the
criteria
to ALL.


Sub Filter()
With Range("A1:A5")
.Autofilter
.AutoFilter Field:=1, Criteria1:="="
.AutoFilter Field:=1
End With
End Sub

--
Cheers
Nigel



"Ian Macfarlane" wrote in message
...
I have set up my filters(datafilterauto filter)
Now I want a macro that will do the following:
By invoking the macro it will
1. Show only the blank cells on any given selected col
and by invoking the same macro will display ALL the entries in a

selected
col

Would appreciate some help
Thanks








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
Macro required please Dr Hackenbush Excel Discussion (Misc queries) 4 February 10th 10 09:29 AM
Macro Help Required Dan Wood Excel Discussion (Misc queries) 3 January 5th 10 05:49 PM
Macro required PCOR Excel Worksheet Functions 3 December 11th 05 07:36 PM
vba macro required ? Peter O'Leary Links and Linking in Excel 1 April 14th 05 11:49 PM
Macro help required! Don Niall Excel Programming 7 June 24th 04 07:12 PM


All times are GMT +1. The time now is 03:59 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"