View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Searching a sheet for rows that meet more than one column criteria

Hi Chrisso,

Try turning on the macro recorder whilst you perform the
requisite operations manually. This will provide code which
may be edited to provide a more efficient, generic procedure.

Instead of looping through the original range, you could use
something like:

'=============
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim RngOut As Range

Set WB = Workbooks("MyBook.xls") '<<=== CHANGE
Set SH = WB.Sheets("Sheet1") '<<=== CHANGE

Set RngOut = SH.AutoFilter.Range.SpecialCells(xlVisible)
Debug.Print RngOut.Address(0, 0)

End Sub
'<<=============


---
Regards,
Norman


"Chrisso" wrote in message
oups.com...
Oh - I see.

Do you mean:
- apply the auto -filter in VB
- specifiy the criteria for the auto-filter in VB
- VB loop through the original list and the visible rows are the rows
that match the criteria (look at the hidden property)

Is that right? I want the result to for more VB logic not to show the
user.

Thanks for your response.

Chris