If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > VBA help on .AutoFilter results

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-23-09, 10:50
Sam Landy Sam Landy is offline
Registered User
 
Join Date: May 2004
Location: New York State
Posts: 931
VBA help on .AutoFilter results

Hi. I'm able to create the .AutoFilter using VBA, but I haven't a clue how to:

(1) Find out if the .AutoFilter method produced any results or not,

(2) Navigate to the top row of the range, and

(3) Advance from row to row.

I need to use the values in each cell to initialize a numeric variable for use in an accounting application. I'm using Excel 2K3 with Windows XP.

Thanks so much for your help.

Sam
Reply With Quote
  #2 (permalink)  
Old 07-29-09, 14:50
texasalynn texasalynn is offline
Registered User
 
Join Date: Jun 2002
Location: Houston, TX
Posts: 116
here is a partial example of checking if the autofilter produced anything

Code:
Selection.AutoFilter Field:=18, Criteria1:="=1", Operator:=xlAnd
LR = Cells(65536, 2).End(xlUp).Row
    If LR > 1 Then
HTH
__________________
texasalynn
It's AWL Good!
Reply With Quote
  #3 (permalink)  
Old 08-19-09, 04:17
CasparV CasparV is offline
Registered User
 
Join Date: Jul 2007
Posts: 54
Why not try recording a new macro (Tools -> Macro -> Record New Macro) and then manually do exactly what you are talking about. Then stop the recording and go into the macro you have just created and have a look at what you have got. That should give you most of the code you need, although you will have to mess about with some variables to make it flexible to work in all circumstances.

HTH
Caspar
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On