ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with FOR LOOP and and Advance Filter (https://www.excelbanter.com/excel-programming/402089-help-loop-advance-filter.html)

Ayo

Help with FOR LOOP and and Advance Filter
 
I was wondering if it is possible to use a:
For Each c in Range().Cells
to loop through an autofilter range or an advance filter range.

What I am trying to do is run an advance filter in place and use the For
Each c in Range().Cells loop through the filtered data and place the results
of the loop on another sheet in the worrkbook. Is this possible? If so, can
someone place give me an idea how to do this, please?
Thank you
Ayo

Gary Keramidas[_2_]

Help with FOR LOOP and and Advance Filter
 
i've used something like this snippet:

Set rng = Range(ws.Cells(2, "D"), ws.Cells(6,
"D").End(xlDown)).SpecialCells(xlCellTypeVisib le)
For Each cell In rng
' do something
Next

--


Gary Keramidas


"Ayo" wrote in message
...
I was wondering if it is possible to use a:
For Each c in Range().Cells
to loop through an autofilter range or an advance filter range.

What I am trying to do is run an advance filter in place and use the For
Each c in Range().Cells loop through the filtered data and place the
results
of the loop on another sheet in the worrkbook. Is this possible? If so,
can
someone place give me an idea how to do this, please?
Thank you
Ayo



Ayo

Help with FOR LOOP and and Advance Filter
 
Thanks a lot Gary. I think this might do the job.

"Gary Keramidas" wrote:

i've used something like this snippet:

Set rng = Range(ws.Cells(2, "D"), ws.Cells(6,
"D").End(xlDown)).SpecialCells(xlCellTypeVisib le)
For Each cell In rng
' do something
Next

--


Gary Keramidas


"Ayo" wrote in message
...
I was wondering if it is possible to use a:
For Each c in Range().Cells
to loop through an autofilter range or an advance filter range.

What I am trying to do is run an advance filter in place and use the For
Each c in Range().Cells loop through the filtered data and place the
results
of the loop on another sheet in the worrkbook. Is this possible? If so,
can
someone place give me an idea how to do this, please?
Thank you
Ayo




Ayo

Help with FOR LOOP and and Advance Filter
 
What exactly does this do? I am a bit confused with the Range(ws.Cells(2,
"D"), ws.Cells(6,"D").End(xlDown)) part espeecially the Range(ws.Cells(2,
"D"), ws.Cells(6,"D") part. Can you explain that part to me.
I am guessing that Range(ws.Cells(2, "D"), ws.Cells(6,"D") is the same as
Range(Cells(2, 4), (6,4). Is this correct? And if so, what does the
..End(xlDown) do?

Thanks again for the help.

"Gary Keramidas" wrote:

i've used something like this snippet:

Set rng = Range(ws.Cells(2, "D"), ws.Cells(6,
"D").End(xlDown)).SpecialCells(xlCellTypeVisib le)
For Each cell In rng
' do something
Next

--


Gary Keramidas


"Ayo" wrote in message
...
I was wondering if it is possible to use a:
For Each c in Range().Cells
to loop through an autofilter range or an advance filter range.

What I am trying to do is run an advance filter in place and use the For
Each c in Range().Cells loop through the filtered data and place the
results
of the loop on another sheet in the worrkbook. Is this possible? If so,
can
someone place give me an idea how to do this, please?
Thank you
Ayo




Gary Keramidas[_2_]

Help with FOR LOOP and and Advance Filter
 
it was just an example of how to select a range. the end.down goes down to
the last filled cell and uses that and the last cell in the range. it just
used row 6 as the starting point.

like i said, it was just an example.

--


Gary Keramidas


"Ayo" wrote in message
...
What exactly does this do? I am a bit confused with the Range(ws.Cells(2,
"D"), ws.Cells(6,"D").End(xlDown)) part espeecially the Range(ws.Cells(2,
"D"), ws.Cells(6,"D") part. Can you explain that part to me.
I am guessing that Range(ws.Cells(2, "D"), ws.Cells(6,"D") is the same as
Range(Cells(2, 4), (6,4). Is this correct? And if so, what does the
.End(xlDown) do?

Thanks again for the help.

"Gary Keramidas" wrote:

i've used something like this snippet:

Set rng = Range(ws.Cells(2, "D"), ws.Cells(6,
"D").End(xlDown)).SpecialCells(xlCellTypeVisib le)
For Each cell In rng
' do something
Next

--


Gary Keramidas


"Ayo" wrote in message
...
I was wondering if it is possible to use a:
For Each c in Range().Cells
to loop through an autofilter range or an advance filter range.

What I am trying to do is run an advance filter in place and use the
For
Each c in Range().Cells loop through the filtered data and place the
results
of the loop on another sheet in the worrkbook. Is this possible? If so,
can
someone place give me an idea how to do this, please?
Thank you
Ayo






All times are GMT +1. The time now is 06:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com