+ Reply to Thread
Results 1 to 3 of 3

Selecting correct cell after Autofilter

Hybrid View

  1. #1
    Registered User
    Join Date
    03-09-2010
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    59

    Selecting correct cell after Autofilter

    Hey all,

    I am trying to copy some text and then search with an Autofilter and paste it into the first cell on the results.

    For example:

    Searched for Criteria = "2" in Column = "ID"

    And get:
    A B C
    1 ID Location Address
    4 2 The location The address

    Now I want to paste the text for the new location into A4 but not sure how to select that cell after the search.

    I currently have the following:
    Sheets("Input").Select
        Range("B2").Select
        Range(Selection, Selection.End(xlToRight)).Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("Data").Select
            ActiveSheet.Range("$A$1:$X$19304").AutoFilter Field:=1, Criteria1:=Evaluate("idnum"), _
           Operator:=xlAnd
           'Here is the issue!
           Range("B2").Select  <--- This is where I need to select the right cell but not sure how. 
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
    Thanks!
    Last edited by subtilty; 04-19-2011 at 11:50 AM.

  2. #2
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Selecting correct cell after Autofilter

    maybe use:
    Range("B65536").End(xlup).Offset(-1,0).Select
    This will allow you to be below all data and will move the selection to the first empty cell below data in the filtered B column. If you don't need to be below the data then remove this part:
    .Offset(-1,0).

  3. #3
    Registered User
    Join Date
    03-09-2010
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: Selecting correct cell after Autofilter

    Fantastic works perfectly. Thanks!

+ 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