Saltar al contenido principal

¿Cómo seguir el hipervínculo a la hoja oculta en Excel?

Por ejemplo, tengo un libro de trabajo que contiene varias hojas de trabajo, la primera hoja maestra tiene hipervínculos a otras hojas y ahora, oculto todas las hojas excepto la primera. En este caso, los hipervínculos que enlazan con hojas ocultas no están disponibles. Pero, ¿cómo puede hacer que estos hipervínculos funcionen correctamente? Cuando hace clic en un hipervínculo, la hoja oculta vinculada se abrirá a la vez como se muestra en la siguiente captura de pantalla:

hipervínculo del documento a la hoja oculta 1

Siga el hipervínculo para abrir la hoja oculta con código VBA

Siga el hipervínculo para abrir la hoja oculta y luego ocúltela nuevamente con el código VBA


Siga el hipervínculo para abrir la hoja oculta con código VBA

El siguiente código VBA puede ayudarlo a abrir la hoja de trabajo oculta al hacer clic en su hipervínculo relativo, haga lo siguiente:

1. Haga clic con el botón derecho en la pestaña de la hoja que desea seguir el hipervínculo a la hoja oculta, y luego elija Ver código en el menú contextual, en el emergente Microsoft Visual Basic para aplicaciones ventana, copie y pegue el siguiente código en el módulo en blanco:

Código de VBA: siga el hipervínculo para abrir la hoja oculta:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Updateby Extendoffice
    Application.ScreenUpdating = False
    On Error Resume Next
    If Target.Column = 1 Then
        Sheets(Target.Value).Visible = xlSheetVisible
        Sheets(Target.Value).Select
    End If
    Application.ScreenUpdating = True
End Sub

hipervínculo del documento a la hoja oculta 2

Note: En el código anterior, el número 1 en este Si Target.Column = 1 Then El script indica el número de columna que contiene los hipervínculos, cámbielo según sus necesidades.

2. Luego guarde y cierre esta ventana de código, ahora, cuando haga clic en el hipervínculo que enlaza a la hoja oculta específica, la hoja oculta se abrirá de inmediato.


Siga el hipervínculo para abrir la hoja oculta y luego ocúltela nuevamente con el código VBA

A veces, debe seguir el hipervínculo para abrir la hoja oculta y, cuando regrese a la hoja maestra, desea que la hoja abierta se vuelva a ocultar. El siguiente código VBA puede hacerte un favor:

1. Haga clic con el botón derecho en la pestaña de la hoja que desea seguir el hipervínculo a la hoja oculta, y luego elija Ver código en el menú contextual, en el emergente Microsoft Visual Basic para aplicaciones ventana, copie y pegue el siguiente código en el módulo en blanco:

Código de VBA: siga el hipervínculo para abrir la hoja oculta cuando vuelva a ocultarla de nuevo:

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
   'Updateby Extendoffice
    Application.ScreenUpdating = False
    Dim strLinkSheet As String
    If InStr(Target.Parent, "!") > 0 Then
        strLinkSheet = Left(Target.Parent, InStr(1, Target.Parent, "!") - 1)
    Else
        strLinkSheet = Target.Parent
    End If
    Sheets(strLinkSheet).Visible = True
    Sheets(strLinkSheet).Select
    Application.ScreenUpdating = True
End Sub

Private Sub Worksheet_Activate()
    On Error Resume Next
    Sheets(ActiveCell.Value2).Visible = False
End Sub

hipervínculo del documento a la hoja oculta 3

2. Luego guarde el anuncio y cierre la ventana del código, cuando haga clic en el hipervínculo, la hoja oculta vinculada se abrirá inmediatamente, pero, si vuelve a la hoja maestra que contiene los hipervínculos, la hoja abierta se ocultará automáticamente nuevamente.

Note: Estos códigos solo se aplican a los nombres de las hojas que coinciden con el texto de su hipervínculo.


Demostración: siga el hipervínculo para abrir la hoja oculta con código VBA

Kutools for Excel: con más de 300 prácticos complementos de Excel, prueba gratuita y sin límite en 30 días. ¡Descarga y prueba gratis ahora!

Las mejores herramientas de productividad de oficina

🤖 Asistente de IA de Kutools: Revolucionar el análisis de datos basado en: Ejecución inteligente   |  Generar codigo  |  Crear fórmulas personalizadas  |  Analizar datos y generar gráficos  |  Invocar funciones de Kutools...
Características populares: Buscar, resaltar o identificar duplicados   |  Eliminar filas en blanco   |  Combine columnas o celdas sin perder datos   |   Ronda sin fórmula ...
Super búsqueda: Búsqueda virtual de criterios múltiples    Búsqueda V de valores múltiples  |   VLookup en varias hojas   |   Búsqueda difusa ....
Lista desplegable avanzada: Crear rápidamente una lista desplegable   |  Lista desplegable dependiente   |  Lista desplegable de selección múltiple ....
Administrador de columnas: Agregar un número específico de columnas  |  Mover columnas  |  Toggle Estado de visibilidad de columnas ocultas  |  Comparar rangos y columnas ...
Características destacadas: Enfoque de cuadrícula   |  Vista de diseño   |   Gran barra de fórmulas    Administrador de hojas y libros de trabajo   |  Biblioteca de Recursos (Texto automático)   |  Selector de fechas   |  Combinar hojas de trabajo   |  Cifrar/descifrar celdas    Enviar correos electrónicos por lista   |  Súper filtro   |   Filtro especial (filtro negrita/cursiva/tachado...) ...
Los 15 mejores conjuntos de herramientas12 Texto Herramientas (Añadir texto, Quitar caracteres, ...)   |   50+ Tabla Tipos (Diagrama de Gantt, ...)   |   40+ Práctico Fórmulas (Calcular la edad según el cumpleaños, ...)   |   19 Inserción Herramientas (Insertar código QR, Insertar imagen desde la ruta, ...)   |   12 Conversión Herramientas (Números a palabras, Conversión de Moneda, ...)   |   7 Fusionar y dividir Herramientas (Filas combinadas avanzadas, Células partidas, ...)   |   ... y más

Mejore sus habilidades de Excel con Kutools for Excel y experimente la eficiencia como nunca antes. Kutools for Excel ofrece más de 300 funciones avanzadas para aumentar la productividad y ahorrar tiempo.  Haga clic aquí para obtener la función que más necesita...

Descripción


Office Tab lleva la interfaz con pestañas a Office y hace que su trabajo sea mucho más fácil

  • Habilite la edición y lectura con pestañas en Word, Excel, PowerPoint, Publisher, Access, Visio y Project.
  • Abra y cree varios documentos en nuevas pestañas de la misma ventana, en lugar de en nuevas ventanas.
  • ¡Aumenta su productividad en un 50% y reduce cientos de clics del mouse todos los días!
Comments (9)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Not sure if I will get a response to this one, but when I click the any of my hyperlinks I get a "reference isn't valid" error.
Everything still works, I just need to click ok to continue.
Does anyone have an idea what causes this error for this code?
Thank you,
This comment was minimized by the moderator on the site
I have created many wordbook and I want to index those in one page.

N.B: My point is I want to hide all the sheets, the sheets will linked with setting picture to main page. By clicking the picture linked sheet will be shown and when I come back to the main sheet the un-hide sheet will be hidden again
This comment was minimized by the moderator on the site
I would like to use this code but only want it to apply to column A. I have other web address links in other cells which cause a problem when running this code.
This comment was minimized by the moderator on the site
My hyperlink "text" is number only, and it doesn't work...
This comment was minimized by the moderator on the site
I'm using the code on two different sheets. It works for one of about 40 hyperlinks on one sheet and it opens two of about 10 hyperlinks one she second, the sheets on the second which do open do go back into hiding when I return to the sheet. The error I get when it will not open a sheet is Run-time error"9": script out of range and the code it points me to - Sheets(strLinkSheet).Visible = True Any ideas as to what change is needed make the code work on all of the sheets? Thank you in advance.
This comment was minimized by the moderator on the site
I have used this code on two different sheets in my workbook, and in both cases it works great, except for the first hyperlink on each page. I get "Subscript out of range error" and the debugger points to the "Sheets(strLinkSheet).Visible = True" right after the "end if". Anyone else see this error? It is only on the first link on the page. (my hyperlinks are in column A, and start in row 2)
This comment was minimized by the moderator on the site
[quote]I have used this code on two different sheets in my workbook, and in both cases it works great, except for the first hyperlink on each page. I get "Subscript out of range error" and the debugger points to the "Sheets(strLinkSheet).Visible = True" right after the "end if". Anyone else see this error? It is only on the first link on the page. (my hyperlinks are in column A, and start in row 2)By HelzBelz[/quote] Sheet names can't have space like "Sheet 1". I fixed my sheet names to "Sheet1" and the error stopped.
This comment was minimized by the moderator on the site
I have a sheet that is hidden that contains a hyperlink. I would like to be able go to the hidden sheet and have it close when I go back to the original sheet. I used the code but it does not work.
This comment was minimized by the moderator on the site
I am trying to hide a sheet that has a hyperlink. I would like to be able to click on the sheet go to the hyperlink sheet and then click back to the sheet and close the hidden sheet. I have tried your instructions but it does not work. Not sure what I am doing wrong.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations