Loop Problems

  • Thread starter Thread starter OTI
  • Start date Start date
O

OTI

Hi,

I have data in e28:o250. this data is auto filtered using criteria in column
"A" then copied to another sheet printed and deleted.The problem I have is
that criteria in "A" varies and I wish to use the criteria in A1 then A2
and so forth until an empty cell.

I am having trouble with "DO UNTIL" function.

Thanks in advance

Gary
 
Gary,

Try the macro below. This assumes that the filtering is based on
column E - you'll need to change
Field:=1
to the appropriate column number within your range. Also assumes no
other data in column A other than your list of criteria.

HTH,
Bernie
MS Excel MVP

Sub SequentialFilter()
Dim myCell As Range
Dim myRange As Range

Set myRange = Range("A1", Range("65536").End(xlUp))

For Each myCell In myRange
Range("E28:O250").AutoFilter _
Field:=1, _
Criteria1:=myCell.Value

'Do other stuff here while the list is filtered

Next myCell

End Sub
 
Back
Top