ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How to add prefix to names in a column (https://www.excelbanter.com/excel-worksheet-functions/451060-how-add-prefix-names-column.html)

[email protected]

How to add prefix to names in a column
 
I have 1000 plant names in a column I want to add the prefix "http://www.google.com/images?q=" to

So

"Acer Campestre"

and so on become

http://www.google.com/images?q=Acer Campestre

This is a one time operation, as I will copy all these links to somewhere else.


Claus Busch

How to add prefix to names in a column
 
Hi,

Am Sun, 30 Aug 2015 11:29:30 -0700 (PDT) schrieb
:

I have 1000 plant names in a column I want to add the prefix "http://www.google.com/images?q=" to


"Acer Campestre"

and so on become

http://www.google.com/images?q=Acer Campestre

your names in column A. Then try:

Sub Hyp()
Dim LRow As Long, i As Long

Const myStr = "http://www.google.com/images?q="
With ActiveSheet
LRow = .Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To LRow
.Hyperlinks.Add _
anchor:=.Cells(i, 1), _
Address:=myStr & .Cells(i, 1)
Next
End With
End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional


All times are GMT +1. The time now is 03:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com