+ Reply to Thread
Results 1 to 6 of 6

Reset ComboBox After Making A Selection

  1. #1
    Registered User
    Join Date
    08-08-2013
    Location
    Pennsylvania, United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Reset ComboBox After Making A Selection

    Hi, I'm currently working on a drop-down menu in an Excel sheet that has links to web pages in it. When you click one of the options on the drop-down it takes you to that webpage. That part was simple enough: I used 2 columns, one for the name and one for the URL and placed the following code:
    Please Login or Register  to view this content.
    Everything worked with that! Now what I am trying to do is make it so that after you click a link, the ComboBox will go back to the default value (example: "Title"). To do that I added one more line of code:
    Please Login or Register  to view this content.
    That did everything that I wanted except I would get an error at the end of execution that Excel could not open the webpage. What it is doing is going through the code and opening the first webpage then when it populates the ComboBox with ListIndex 0 again it goes through the whole function AGAIN. I need it to not do that. To get a clearer idea of how my list is structured here is a short format example:

    Title <blank cell>
    Site 01 URL 01
    Site 02 URL 02
    Site 03 URL 03
    Site 04 URL 04

    The ComboBox displays the first column, but opens the URL in the second column. If you need more clarification don't hesitate to ask!

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Reset ComboBox After Making A Selection

    Just out of curiosity what happens if you change this:
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Check the ListIndex of the ComboBox before using FollowHyperlink.

    If iit's 0 exit the sub.
    If posting code please use code tags, see here.

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Reset ComboBox After Making A Selection

    Hello Liz3nz,

    Welcome to this Forum!

    I am taking a wide guess here, but try:

    Please Login or Register  to view this content.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Reset ComboBox After Making A Selection

    @ Norie,

    I like your suggestion.

  6. #6
    Registered User
    Join Date
    08-08-2013
    Location
    Pennsylvania, United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Reset ComboBox After Making A Selection

    XeRo: That crashes the program before it even opens the first webpage.

    Winon: I tried that before too and it was giving me an error. I had put MMBox.Value = Null for a while, which worked but the text in the box was blank.

    Norie: That answer was so obvious! Funny how you miss the most obvious things sometimes haha. I put the FollowHyperlink in an If statement and it works great now .

    Thank you all for your help!
    Please Login or Register  to view this content.

+ 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. [SOLVED] Command button to reset ComboBox selection
    By Darrenh1238 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-09-2012, 06:14 AM
  2. Code to reset combobox dependant on another combobox
    By j.farr3ll in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-08-2011, 08:21 AM
  3. Populate a activeX combobox from a selection of another combobox
    By ptramel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-28-2009, 06:50 PM
  4. How to reset all combobox ant textbox with one command?
    By cshm in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-28-2008, 11:31 AM
  5. Making a template with reset button
    By Lisa in forum Excel General
    Replies: 1
    Last Post: 02-18-2005, 10:06 AM

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