LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
bst bst is offline
external usenet poster
 
Posts: 19
Default manipulating results of autofilter in vba

i'm working on an inventory tracking sheet that has a snapshot of data
for the current week and the week before. it tracks changes in inventory
assignment. i have already built an array that has each unique id for
the inventory that is being tracked. i then want to loop the array
applying an autofilter on the sheet with the criteria based on the array
data. the result of the autofilter (not counting the header) either 1
row (the item has been removed from inventory) or two rows (the data is
still in inventory, need to check if it has been reassigned).

my problem is that i can't seem to test for how many rows resulted in
the autofilter.

what i have so far:
for xCtr = 1 to totalSerials
ActiveSheet.UsedRange.Select
Selection.AutoFilter field:=2, Criteria1:=uniqueSerials(xCtr)
Set filteredRange = selection.SpecialCells(xlCellTypeVisible)

if filteredRange.rows.count = 1 then
filteredRange.cells(2,colException).value = "x"
'row 2 because the first row is the header
end if
if filteredRange.rows.count = 2 then
if filteredRange.cells(2,colName).value < _
filteredRange.cells(3, colName).value then
filteredRange.cells(2, colException).value = "x"
filteredRange.cells(3, colException).value = "x"
end if
end if
selection.autofilter
next xCtr

then i'll sort the sheet based on the exception column

the first time the macro is ran it works fine, afterwards
filteredRange.rows.count returns 1 everytime. i get the same results
with filteredRange.specialcells(xlCellTypeVisible).coun t
i have tried assigning filteredRange different ways as well with the
same results.

do i even need filteredRange? if not how should i proceed? if so, how
can i get it to work as desired? i've read about 10 pages of google
searching autofilter in the newsgroup and can't seem to find what i
need. copying the rows to another sheet would make the macro run too
long and is not desired since i want to sort the results of the
conditionals above.

TIA
bst
 
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
emailing autofilter results Dianeg Excel Worksheet Functions 3 January 19th 10 10:02 AM
Autofilter results Ben Wunderin Excel Discussion (Misc queries) 3 December 2nd 08 12:31 AM
Using autofilter results Cleber Inacio Excel Programming 1 November 18th 07 07:11 PM
Get Average on results of Autofilter [email protected] Excel Programming 3 May 8th 06 11:42 PM
Count of results in AutoFilter andrew Excel Programming 3 October 2nd 04 12:45 AM


All times are GMT +1. The time now is 11:16 PM.

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"