
Estoy intentando crear una celda que incluya un hipervínculo basado en lo que se completa en otra celda de Excel. Tengo la parte del hipervínculo funcionando, pero me gustaría tener una mejor etiqueta para el hipervínculo que la ID que utiliza para obtener la página web o la dirección web completa. Pensé que sería más fácil intentar incluir el título de las páginas web. es posible?
Tal vez para ayudar un poco, actualmente estoy usando esta función para obtener la dirección web.
=IF(LEN(Excel Cell Value)>0,HYPERLINK(CONCATENATE("First part of the web address",(Excel Cell Value),"Second part of the web address"),Excel Cell Value),"")
Respuesta1
=IF(LEN(Excel Cell Value)>0,HYPERLINK(CONCATENATE("First part of the web address",(Excel Cell Value),"Second part of the web address"),Excel Cell Value),"")
No entiendo esto. Déjame intentar descomponerlo.
If(Len(cell value)>0) - if the cell isn't empty, do TRUE
TRUE - Hyperlink(Concatenate(first, (cell value), second), (cell value)
FALSE - ""
Ahora veamos cómo funciona el hipervínculo.
Hyperlink(link location, friendly name)
Para ti esto es
link location = concatenate(first, value, second)
friendly name = value
Está asignando el nombre descriptivo como valor de la celda. Entonces, a menos que tengas algo como...
A1 = Google
A2 = Hyperlink(Concatenate("https://www.",A1,".com",A1))
A2 =Google
Esto no funcionará. Lo único que podrá hacer es usar VBA para ir a la página y recopilar información, o usar algo como:
A1 = Google
A2 = Searching Website
A3 = Hyperlink(Concatenate("https://www.",A1,".com",A2))
Para obtener el título a través de VBA -
Sub gettitle()
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate "http://superuser.com/"
While ie.busy
DoEvents
Wend
Dim title As String
title = ie.document.title
MsgBox (title)
End Sub
Bien, para hacer que una función devuelva el hipervínculo con el título, necesitará una función definida por el usuario (UDF):
Function GetTitle(site As Range) As String
Dim title As String
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate site
While ie.busy
DoEvents
Wend
title = ie.document.title
ie.Quit
GetTitle = title
End Function
Esto irá al destino de la página web y devolverá el título. Entonces, digamos que tiene una página web en la celda A1
; ahora necesita llamar a su función para obtener el título.
A2 = GetTitle(A1)
A3 = Hyperlink(A1,A2)