+ Reply to Thread
Results 1 to 3 of 3

How to select a range based on values in 1 column

  1. #1
    ForestRamsey
    Guest

    How to select a range based on values in 1 column

    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?

  2. #2
    Tom Ogilvy
    Guest

    Re: How to select a range based on values in 1 column

    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.

    --
    Regards,
    Tom Ogilvy

    "ForestRamsey" <[email protected]> wrote in message
    news:[email protected]...
    > 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?




  3. #3
    ForestRamsey
    Guest

    Re: How to select a range based on values in 1 column

    Thanks kindly for the help.

    "Tom Ogilvy" wrote:

    > 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.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "ForestRamsey" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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?

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1