VBA for creating Hyperlink based on value entered in Cell

  • I was wondering how I would be able to create a hyperlink based on the cell value which is entered.


    The link looks like this : pcdocs://docs/2036625/R


    If someone enters a value into any cell in column A (the value being the "document number") it would create the hyperlink based on the document number entered and would add the hyperlink to the entered text in the cell. The document number is bolded in the link above.


    Thanks!

  • This is the recorded macro for one document entry. I require it to apply to any document number that gets entered in the cells in range (column A). Thanks!


  • put this in worksheet_change for whatever sheet the column is on


    Code
    If ActiveCell.Column = 1 Then ActiveSheet.Hyperlinks.Add Anchor:=ActiveCell, Address:="pcdocs://docs/" & ActiveCell & "/R"
  • I got it to work however I encounter so problems. If something is entered into the active cell and enter is pressed to accept the entry the hyperlink then appears in the next active cell (being the cell below). Also if values are copied and pasted into Column A I had hoped they would all be assigned the appropriate hyperlink however this only triggers the hyperlink to appear in the active cell after pasting values.
    Solutions?


    Thanks!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!