+ Reply to Thread
Results 1 to 20 of 20

VBA Combobox with hyperlink

  1. #1
    Registered User
    Join Date
    10-29-2020
    Location
    italy
    MS-Off Ver
    2019
    Posts
    28

    VBA Combobox with hyperlink

    Hi, before writing the post I searched around about my problem.

    I have a combobox that allows me to select the exercises and insert them in the cell I want, everything works fine here.

    The problem is that the source cell contains a hyperlink that is not included in the new cell.

    Can someone help me ?

    I attach the images and Code

    HTML Code: 
    VBA Combobox Hyperlink-min.jpg

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: VBA Combobox with hyperlink

    more than likely you can't change this, because this is a consequence of how excel's source code is written. however, you can probably add some code to automate the addition of hyperlinks to the cells that you are populating from the dropdown. here's an example of how a column of data, which is originally text, can be turned into hyperlinks that have the same URL address as the actual text sitting in the cells:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-29-2020
    Location
    italy
    MS-Off Ver
    2019
    Posts
    28

    Question Re: VBA Combobox with hyperlink

    Thank you for answering. I tried to apply your advice but being a novice I didn't quite understand how to apply the example code. Could you please give me more information?

    obviously how it is posted below is wrong ...
    But I started from this base.

    Attached I left the excel file and img, maybe it could be useful.

    ptv.PNG
    Attached Files Attached Files
    Last edited by snake93x; 11-01-2020 at 09:21 AM.

  4. #4
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: VBA Combobox with hyperlink

    I'm getting some ridiculous errors in Excel again, but I'm sure this SHOULD work fine:
    Please Login or Register  to view this content.
    see if it works for you. if it doesn't, let us know. according to some on the internet, this makes no sense as well:

    https://www.mrexcel.com/board/thread...e-help.631085/

    REFS
    https://docs.microsoft.com/en-us/off...nction.vlookup

    https://support.microsoft.com/en-us/...8-93a18ad188a1

    https://excelmacromastery.com/vba-vlookup/

    https://docs.microsoft.com/en-us/off...cel.range.find

    now, there are other factors involved with what I did, but I'm posting it to see if you understand what I did?
    Attached Files Attached Files
    Last edited by vba_php; 11-01-2020 at 08:48 PM.

  5. #5
    Registered User
    Join Date
    10-29-2020
    Location
    italy
    MS-Off Ver
    2019
    Posts
    28

    Re: VBA Combobox with hyperlink

    Thanks for reply and time you are dedicating to me.
    Unfortunately that's not what I was looking for, i would need to link directly to the names of the exercises. I found youtube.com/watch?v=Iylrxl4hW9M&feature=youtu.be&t=257 this video, explaining how to create a drop down menu with data validation. That's exactly what i was looking for, however, i was wondering if it was possible to add links in the dropdown menu.

    Now, can this function be done via VBA combobox or data validation? It's a process that would speed up my work. The final product i want is a workout card with exercise names that are hyperlinked. Currently I have to take every single link from youtube and insert it manually in every single exercise. I thought I had a faster job with a dropdown containing hyperlinked exercise name.

  6. #6
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: VBA Combobox with hyperlink

    Quote Originally Posted by snake93x View Post
    Now, can this function be done via VBA combobox or data validation?
    you know, I'm not really sure. I'm more of a coder and I don't generally do much through the interface, although I know how to do quite a bit. I cannot help anymore here. I apologize. Hopefully the pros here can help out.

  7. #7
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: VBA Combobox with hyperlink

    is this what you want?

    Please Login or Register  to view this content.
    多么想要告诉你 我好喜欢你

  8. #8
    Registered User
    Join Date
    10-29-2020
    Location
    italy
    MS-Off Ver
    2019
    Posts
    28

    Re: VBA Combobox with hyperlink

    Ohh! Thank you very much, you helped me a lot. That's what I was trying to do, now I can boost my work process.
    Thanks again for answering my question.

  9. #9
    Registered User
    Join Date
    10-29-2020
    Location
    italy
    MS-Off Ver
    2019
    Posts
    28

    Re: VBA Combobox with hyperlink

    Hi, here i am back to improve the functionality of the proposed code.

    Only after having compiled a good list, I realized that when a link is not available, excel reports an error.

    Do you think it is possible to fix this little bug?

  10. #10
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: VBA Combobox with hyperlink

    Try:
    Please Login or Register  to view this content.
    Last edited by millz; 11-17-2020 at 03:13 AM.

  11. #11
    Registered User
    Join Date
    10-29-2020
    Location
    italy
    MS-Off Ver
    2019
    Posts
    28

    Re: VBA Combobox with hyperlink

    Thanks, it works correctly.

  12. #12
    Registered User
    Join Date
    10-29-2020
    Location
    italy
    MS-Off Ver
    2019
    Posts
    28

    Re: VBA Combobox with hyperlink

    Hi, come back for another short question.

    I have been trying to fix a problem for 4 days, but have failed.

    Basically I'm trying to have more columns available for the Dtatabase sheet.

    So I changed .Columns (1) to Columns ("A: K"), this works, but some cells are ignored and others replaced.

    Can you help me?

    Thanks


    Formula: copy to clipboard
    Please Login or Register  to view this content.

  13. #13
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: VBA Combobox with hyperlink

    Quote Originally Posted by snake93x View Post
    but some cells are ignored and others replaced
    You need to elaborate on this, or show a new sample file with the problem(s). The code looks fine.

  14. #14
    Registered User
    Join Date
    10-29-2020
    Location
    italy
    MS-Off Ver
    2019
    Posts
    28

    Re: VBA Combobox with hyperlink

    Thanks for the reply, I have attached the file containing the complete code.

    At this point I assume that the problem is the second piece of code in .Range ("A2"). End (xlDown) .Row etc ...

    In database sheet, cell A2 contains the squat exercise with link to the video. When in coaching sheet insert squat in the first line of training day 1, the link does not work, while the other exercises are ok.

    -

    Furthermore, is it possible to limit the comboboxes only to the coaching sheet? When I modify the database sheet by adding or deleting exercises, the combobox unintentionally adds me the previously selected exercise.
    Attached Files Attached Files

  15. #15
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: VBA Combobox with hyperlink

    I have re-coded your category change. See if this is better:
    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    10-29-2020
    Location
    italy
    MS-Off Ver
    2019
    Posts
    28

    Re: VBA Combobox with hyperlink

    Thanks again for your reply. The code seems to work, however, when hit the category combobox, clicking on main lift, the exercises combobox shows me the categories again.

    screen1.PNG

    entered your code like this, right?
    Please Login or Register  to view this content.

  17. #17
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: VBA Combobox with hyperlink

    Right, probably because you have a list of that on column M of database.

    So this would limit the search range:
    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    10-29-2020
    Location
    italy
    MS-Off Ver
    2019
    Posts
    28

    Re: VBA Combobox with hyperlink

    Thanks, the code is great and working fine. However, the problem of broken links persists.

    If I choose to include the squat exercise, it contains a different link from the original. This only persists for cells A2 and A3 of the database, all other links work fine. I really have no idea what it might be.

    I would be very grateful if you could help me with this last bug.

    Thanks for your time and patience, I respect you very much.

  19. #19
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: VBA Combobox with hyperlink

    I think it's because you have many similarly named exercises, and Excel was doing partial matching with finding the names. Just add this part to make it match with the whole cell content. This also means that the problem may occur again if you have 2 exercises with the same name.
    Please Login or Register  to view this content.

  20. #20
    Registered User
    Join Date
    10-29-2020
    Location
    italy
    MS-Off Ver
    2019
    Posts
    28

    Re: VBA Combobox with hyperlink

    Great, it's ok now, it's working fine. I will keep in mind your observation of exercises of the same name, I will adopt variations.

    You were my hero for this project, thank you very much.
    I am grateful to you for the time and patience you have given me.

    Have a nice day, greetings.

+ 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] ActiveX Combobox in worksheet when populating the list based on another Combobox get error
    By jprlimey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-27-2020, 10:54 AM
  2. [SOLVED] ComboBox to populate Listbox and 2nd Combobox based on 1st combobox dropdown choice
    By bbqqsmokeman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2017, 08:21 PM
  3. ComboBox values source being changed based on another combobox selection in a UserForm
    By stephenanderson in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-08-2016, 11:12 PM
  4. [SOLVED] Code required to Auto Populate 3rd Combobox based on 02nd Combobox Selection
    By bimmy80 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-14-2015, 03:56 AM
  5. Userform Combobox to populate form: Can I change the order of the columns in the combobox?
    By CraigWiggins in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-31-2014, 12:14 PM
  6. [SOLVED] Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox select
    By MileHigh_PhD in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2013, 04:50 PM
  7. ListBox/ComboBox Acting as Macro/Hyperlink Tool
    By Phil H in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-31-2006, 07:55 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