Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Changing data returned from an autofilter

Hi,

I am working on code that takes my list, filters first on
column a, changes the data in column a from one thing to
another depending on what the autofilter returns, puts on
another filter in the same column with different criteria,
changes those, and so on.
My problem is that if there is a zero count on the data
returned, the text is copied across the entire spreadsheet
(a1:iv1) (don't know if this is relevant or not, but when
the zero count is returned, i don't see any of the
spreadsheet except for my headers - the rest of it is that
nether region beyond row 65536)...
I've exhausted my brain trying to figure this out.
Below is a snippet of the code that is causing me a
problem:

Selection.AutoFilter Field:=1, Criteria1:="=E*",
Operator:=xlOr, Criteria2:="=D*"
Selection.AutoFilter Field:=2, Criteria1:="S",
Operator:=xlOr, Criteria2:="E"
Range(ActiveCell, ActiveCell.End(xlDown)).SpecialCells
(xlCellTypeVisible).Value = "UNDER INVESTIGATION"
ActiveSheet.ShowAllData
Range("A1").Offset(1, 0).Select


Does anybody have any suggestions? I hope I've explained
this clearly...
Thanks,
Chris
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Changing data returned from an autofilter

Dim rng as Range, rng1 as Range
set rng = Range(ActiveCell,
ActiveCell.End(xlDown)).SpecialCells(xlCellTypeVis ible).Value
set rng1 = rng.Areas(rng.Areas.count)
if rng1.rows(rng1.rows.count).Row < 65536

rng.Value = "UNDER INVESTIGATION"


or another might be
Dim rng as Range, rng1 as Range
set rng1 = Nothing
set rng = ActiveSheet.Autofilter.Range
set rng = rng.offset(1,0).Resize(rng.rows.count - 1)
set rng = intersect(rng,Activecell.EntireColumn)
on error resume next
set rng1 = rng.SpecialCells(xlVisible)
On error goto 0
if not rng1 is nothing then
rng1.Value = "UNDER INVESTIGATION"
End if



--
Regards,
Tom Ogilvy


"ChrisBat" wrote in message
...
Hi,

I am working on code that takes my list, filters first on
column a, changes the data in column a from one thing to
another depending on what the autofilter returns, puts on
another filter in the same column with different criteria,
changes those, and so on.
My problem is that if there is a zero count on the data
returned, the text is copied across the entire spreadsheet
(a1:iv1) (don't know if this is relevant or not, but when
the zero count is returned, i don't see any of the
spreadsheet except for my headers - the rest of it is that
nether region beyond row 65536)...
I've exhausted my brain trying to figure this out.
Below is a snippet of the code that is causing me a
problem:

Selection.AutoFilter Field:=1, Criteria1:="=E*",
Operator:=xlOr, Criteria2:="=D*"
Selection.AutoFilter Field:=2, Criteria1:="S",
Operator:=xlOr, Criteria2:="E"
Range(ActiveCell, ActiveCell.End(xlDown)).SpecialCells
(xlCellTypeVisible).Value = "UNDER INVESTIGATION"
ActiveSheet.ShowAllData
Range("A1").Offset(1, 0).Select


Does anybody have any suggestions? I hope I've explained
this clearly...
Thanks,
Chris



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
How to use autofilter in excel with formula reference changing Marcio Excel Worksheet Functions 1 April 28th 10 01:29 AM
How do I keep my chart from changing when excel has autofilter? asg2307 Charts and Charting in Excel 2 March 12th 07 08:45 PM
CHANGING POSITION OF AUTOFILTER LIST [email protected] Excel Discussion (Misc queries) 4 September 12th 06 08:35 PM
#value returned instead of data Oscar of Issaquah Salmon Days Festival Excel Worksheet Functions 3 January 26th 06 09:08 PM
Finding row count and filtered rows returned by Autofilter Joseph Uher Excel Programming 0 September 20th 03 08:49 PM


All times are GMT +1. The time now is 12:20 PM.

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"