How to select a range based on values in 1 column

F

ForestRamsey

I'm trying to set up a macro that will allow me to select a range of cells.
The length of the range will vary, based on the results in one column. It
could be a range with no results or possibly 150 results. (I'm sorting based
on a variety of criteria and assigning a value from 1 to 4.)

ie. A B C
address1 name 1 1
address2 name2 2
address3 name3 2
address4 name4 3

How would I tell Excel to grab a range of cells where Column C holds a value
of 2 so that I could grab the data associated with it and dump it elsewhere
for output?
 
T

Tom Ogilvy

Use the autofilter to filter on column C.

Data=>Filter=>Autofilter

In column C, select 2 from the dropdown
do it manually with the macro recorder on, then turn it off and check the
code.


If you copy a filtered range, only the visible cells are copied.
 
F

ForestRamsey

Thanks kindly for the help.

Tom Ogilvy said:
Use the autofilter to filter on column C.

Data=>Filter=>Autofilter

In column C, select 2 from the dropdown
do it manually with the macro recorder on, then turn it off and check the
code.


If you copy a filtered range, only the visible cells are copied.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top