CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    Excel VBA question -- hyperlinks

    Is this possible: I'm pasting a group of URLs that are just in a regular text format into an Excel column. Is there a piece of code that will loop thru each cell in that column and convert the text URLs into regular hyperlinks (that actually go where they're supposed to when clicked?) I tried "paste as hyperlink" already but this doesn't seem to work correctly when more than one cell is being pasted. Thanks. [email protected]


  2. #2
    Guest

    Re: Excel VBA question -- hyperlinks

    Create a button called button1 and place this code in the click event. now select the cells that need to be converted and click on the button. here is the code:

    Dim myRange as Range
    Dim myCell as Range
    Sub Button1_Click()
    set myRange = Application.Selection
    for Each myCell In myRange.Cells
    myCell.Hyperlinks.Add myCell, myCell.Value
    next
    End Sub




    I hope the code is self-explanatory
    Happy Diwali
    Bye,
    Mani. S ( [email protected] )
    PS: in case you didnt know, Diwali is the festival of lights celebrated in India!!!


  3. #3
    Guest

    Re: Excel VBA question -- hyperlinks

    It worked. Thank you!!!!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured