+ Reply to Thread
Results 1 to 2 of 2

Sort but then stay on the same entry

  1. #1
    Registered User
    Join Date
    03-20-2013
    Location
    Yorkshire
    MS-Off Ver
    Excel 2010
    Posts
    3

    Sort but then stay on the same entry

    Excel 2010

    I have a feeling that this should be easy but cannot work out how to do it. Since retiring 7 years ago I seem to have forgotten much of the VBA I use to know.

    I have a sheet of several hundred tree species - one per row. Column C has the English name and D the Latin name. Other columns have other data. I can use a macro to sort by English name and another to sort by Latin name - no problem.

    If the sheet is sorted by English name but then I want to change to sorting to by Latin name I want the same species to be selected after the sort is complete. At present the whole data range remains selected.

    Do I have to read say the Latin name before running the sort, store it in a variable, and then use some type of find function to get back to the original row or is there a better way.

    If I have to do a read and find as above some hints on the syntax to use would be useful.

    AQ

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Sort but then stay on the same entry

    Hi Anthraquinone and congratulations on your first post.

    Try the following:
    a. Get the cell location before you start the sort.
    b. Get the contents of the other column that you want to go to after the sort is completed.
    c. Sort
    d. Find the cell that contains the value obtained in b. above and go to that cell.

    The following code excerpt may help you with some of the above:
    Please Login or Register  to view this content.

    Lewis

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 05-02-2013, 01:05 PM
  2. Auto-sort but stay with cell just entered.
    By Hest20 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-03-2013, 02:44 PM
  3. Why is it when i do sort values do not stay the same
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-09-2011, 02:23 PM
  4. Different SORT based on data entry
    By HuskerBronco in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-27-2008, 05:48 PM
  5. Complex Chart:Need to have COLORS of BARS stay with designated data when I SORT
    By willandr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-04-2007, 05:30 PM
  6. Replies: 4
    Last Post: 08-17-2005, 04:05 PM
  7. [SOLVED] How to link rows in Excel so they will stay together during sort?
    By hospital dietitian in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-05-2005, 03:05 PM
  8. [SOLVED] sorting issue:when i sort, i want them to stay together.
    By steve in forum Excel General
    Replies: 4
    Last Post: 06-22-2005, 02:05 PM

Tags for this Thread

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