LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Accessing rows after AutoFilter


I search the forum for this info, but had no luck, so here goes:

Using VBA (or VB6 externally) I need to do the following:
1) Turn on autofilters
2) Run an autofilter on column "A" looking for any rows with "xxx"
3) On the first row found, extract the value from column "C"
4)Re-autofilter all rows to find those that contain the extracted valu
in column "D"

Seems simple enough, and I have it all working, EXCEPT for part 3)
I cant quite figure out how to select the first row found, which may b
any row number. I even tried selecting the cell on row 1 (headings) an
then using Application.Sendkeys("{DOWN}"), but no workee!

Here is a snipit of code:

Sub SelectItem(Col1 As String, CriteriaValue As String, MatchCol A
String,TgtCol as String)

Dim str As String
Dim colid As Long
Dim common As String
Dim matchid As Long
Dim tgtid As Long

'Convert alpha columns to numeric
str = UCase(Mid(Col1, 1, 1))
colid = Asc(str) - Asc("A") + 1
str = UCase(Mid(MatchCol, 1, 1))
matchid = Asc(str) - Asc("A") + 1
Selection.AutoFilter Field:=colid, Criteria1=CriteriaValue

*' The fuzzy part to get value from first row found
'--------------------------------------
Cells(1, matchid).Select
Application.SendKeys ("{DOWN}")
'--------------------------------------* common = Selection.Value
'Reset original selection
Selection.AutoFilter Field:=colid
'Make calculated selection
Selection.AutoFilter Field:=tgtid, Criteria1:=common
End Sub


Can anyone wake me up!!!

--
MartynGriffi
-----------------------------------------------------------------------
MartynGriffin's Profile: http://www.excelforum.com/member.php...fo&userid=3049
View this thread: http://www.excelforum.com/showthread.php?threadid=50149

 
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 can I use AutoFilter without supressing rows ? Alexandre Excel Discussion (Misc queries) 1 March 5th 07 09:44 PM
AutoFilter and adding new rows JulesM Excel Discussion (Misc queries) 8 October 1st 05 01:19 PM
accessing rows with macros Sam Excel Discussion (Misc queries) 3 April 18th 05 11:56 PM
delete rows autofilter masterphilch Excel Programming 3 January 5th 05 08:07 PM
AutoFilter and Hidden Rows Greg Bloom Excel Programming 1 September 25th 03 11:16 PM


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