+ Reply to Thread
Results 1 to 6 of 6

Long alphabetical list, macro to select first item per letter?

  1. #1
    Forum Contributor
    Join Date
    07-22-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    220

    Long alphabetical list, macro to select first item per letter?

    I have our product list (several thousand items), which is alphabetized by manufacturer; say $E$10:$E$365

    I would like to have macro buttons that will jump to the first item in that list which starts with the corresponding letter.

    Example: I push the "H" button, and would select cell D183 becuase that is the first product which starts with the letter H (even though there may be 50 products that start with H).

    The challenge for me, is the size of the list changes monthly so I can't just create a macro to take me to a specific cell every time.

    Also, I would prefer to not have to enter a letter in a different cell to use as a reference

    Thoughts/ ideas? I've attached an example.

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Long alphabetical list, macro to select first item per letter?

    Rerock,

    Does it have to be a macro? The autofilter feature can do this rather easily. Also the Find feature (ctrl+f)
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Long alphabetical list, macro to select first item per letter?

    Please Login or Register  to view this content.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Long alphabetical list, macro to select first item per letter?

    Hello Rerock,

    Welcome to the Forum!

    You can assign this same macro to each button. It uses the button's letter to find the first cell that begins with that letter. This can be used in Excel 2003 or 2007. The match is not case sensitive. Copy this code to a module in your workbook's VBA project.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Forum Contributor
    Join Date
    04-03-2011
    Location
    India
    MS-Off Ver
    Excel 2015
    Posts
    122

    Re: Long alphabetical list, macro to select first item per letter?

    chk this out in this below line

    Set Btn = ActiveSheet.Shapes(Application.Caller)

  6. #6
    Forum Contributor
    Join Date
    07-22-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    220

    Re: Long alphabetical list, macro to select first item per letter?

    Quote Originally Posted by Leith Ross View Post
    Hello Rerock,

    Welcome to the Forum!

    You can assign this same macro to each button. It uses the button's letter to find the first cell that begins with that letter. This can be used in Excel 2003 or 2007. The match is not case sensitive. Copy this code to a module in your workbook's VBA project.
    Wow, AMAZING!!!! Absolutely NO WAY I could have EVER figured that out on my own.

    Edit: Works in 2010 as well.

+ 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