考慮:
Sub dural()
Dim s1 As String, s2 As String, s3 As String, s4 As String
s1 = "http://maps.google.com/?cbll={"
s3 = "}&cbp=12,90,,0,5&layer=c"
s2 = Range("J1").Text
s4 = s1 & s2 & s3
With ActiveSheet
.Hyperlinks.Add Anchor:=Range("N1"), Address:=s4, TextToDisplay:=s2
End With
End Sub
所以,如果J1包含:
51.507351.,-0.127758
在N1其結果將是:
http://maps.google.com/?cbll= {51.507351, - 。 0.127758} & cbp = 12,90,,0.5 & layer = c
編輯#1:
要運行這個落筆列Ĵ,使用這個版本:
Sub dural2()
Dim s1 As String, s2 As String, s3 As String, s4 As String
Dim N As Long, i As Long
N = Cells(Rows.Count, "J").End(xlUp).Row
s1 = "http://maps.google.com/?cbll={"
s3 = "}&cbp=12,90,,0,5&layer=c"
For i = 1 To N
s2 = Range("J" & i).Text
s4 = s1 & s2 & s3
With ActiveSheet
.Hyperlinks.Add Anchor:=Range("N" & i), Address:=s4, TextToDisplay:=s2
End With
Next i
End Sub
非常好,謝謝! 你能告訴我如何在300多行中重複這個嗎?我嘗試將「J1」更改爲「J1:J300」,但它不喜歡它。 – 2014-11-25 14:31:24
看我的**編輯#1 ** – 2014-11-25 14:43:16
就是這樣!謝謝! – 2014-11-25 14:53:10