excel vba - VBA macro -- hyperlink -


i'd create vba macro allow me edit selected hyperlinks in column , change "text display" same word all. example, if column:

www.google.com/search=cars www.google.com/search=houses www.google.com/search=cities 

i want highlight 3 elements of column , change text display "google search" outcome this:

google search google search google search 

edit: found macro similar want on microsoft support site, issue macro targets hyperlinks in sheet while i'd want select specific column edit hyperlinks.

sub hyperlinkchange() dim oldtext string dim newtext string dim h hyperlink oldtext = "http://www.microsoft.com/" newtext = "http://www.msn.com/" each h in activesheet.hyperlinks x = instr(1, h.address, oldtext) if x > 0 if h.texttodisplay = h.address h.texttodisplay = newtext end if h.address = application.worksheetfunction. _ substitute(h.address, oldtext, newtext) end if next end sub 

this works on current selection:

sub setlinktext() dim linktext string dim h hyperlink linktext = inputbox("enter link text") if linktext = "" exit sub each h in selection.hyperlinks h.texttodisplay = linktext next end sub 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -