Saltar al contenido principal

¿Cómo establecer una contraseña para proteger la hoja oculta en Excel?

Si tiene un libro de trabajo que contiene algunas hojas de trabajo ocultas importantes y no permita que otros las muestren. Ahora, debe establecer una contraseña para proteger las hojas de trabajo ocultas por completo, cuando otros usuarios las muestren, deben ingresar la contraseña. ¿Tiene alguna forma de hacer frente a esta tarea de forma rápida y sencilla en Excel?

Establecer contraseña para proteger hojas ocultas con la función VeryHidden

Establecer contraseña para proteger la hoja oculta con código VBA

Proteja varias hojas de trabajo a la vez con Kutools para Excel


Establecer contraseña para proteger hojas ocultas con la función VeryHidden

Normalmente, puede usar la función VeryHidden para ocultar las hojas de trabajo primero y luego establecer una contraseña para ellas, siga los siguientes pasos:

1. Abra su libro de trabajo y mantenga presionado Alt + F11teclas para abrir el Ventana de Microsoft Visual Basic para aplicaciones.

2. En la Ventana de Microsoft Visual Basic para aplicaciones, haga clic Ver > Proyecto Explorer y Ventana de propiedades to mostrar sus paneles.

doc-proteger-hojas-ocultas-01

3. Y luego en el Proyecto-VBAProject panel, elija la hoja de trabajo que desea ocultar, y en el Propiedades panel, haga clic en la lista desplegable del Visible sección para seleccionar xlHojaMuyOculto opción, ver captura de pantalla:

doc-proteger-hojas-ocultas-02

4. Después de ocultar la hoja de trabajo, puede establecer una contraseña para protegerla. En el Ventana de Microsoft Visual Basic para aplicaciones, haga clic recuadro > Módulo para abrir un módulo vacío y luego haga clic en Herramientas > Propiedades de VBAProject, ver captura de pantalla:

doc-proteger-hojas-ocultas-03

5. Entonces en el apareció Propiedades del proyecto VBAProject cuadro de diálogo, haga clic en Protección pestaña, y luego verificar Bloquear el proyecto para verlo cuadro, finalmente, ingrese y confirme la contraseña en el Contraseña para ver las propiedades del proyecto sección, ver captura de pantalla:

doc-proteger-hojas-ocultas-04

6. Luego haga clic OK para salir de este cuadro de diálogo y cerrar el Ventana de Microsoft Visual Basic para Aplicaciones.

7. Guarde el libro de trabajo como Libro de Excel habilitado para macros formatee y ciérrelo para que la protección con contraseña surta efecto.

doc-proteger-hojas-ocultas-05

8. La próxima vez, cuando abra este libro y desee que las hojas muy ocultas sean visibles, se le solicitará que ingrese una contraseña. Ver captura de pantalla:

doc-proteger-hojas-ocultas-06


Demostración: establezca una contraseña para proteger las hojas ocultas


Establecer contraseña para proteger la hoja oculta con código VBA

Para establecer una contraseña para proteger las hojas ocultas, también puedo hablar sobre un código VBA para usted.

1. Oculte una hoja de trabajo que desee proteger.

2. Mantenga pulsado el ALT + F11 teclas para abrir el Ventana de Microsoft Visual Basic para aplicaciones.

3. Entonces escoge ThisWorkbook desde la izquierda Proyecto Explorer, haga doble clic en él para abrir el Módulo, y luego copie y pegue el siguiente código VBA en el Módulo en blanco:

Código VBA: establezca una contraseña para proteger la hoja oculta

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim xSheetName As String
xSheetName = "Sheet1"
If Application.ActiveSheet.Name = xSheetName Then
    Application.EnableEvents = False
    Application.ActiveSheet.Visible = False
    xTitleId = "KutoolsforExcel"
    response = Application.InputBox("Password", xTitleId, "", Type:=2)
    If response = "123456" Then
        Application.Sheets(xSheetName).Visible = True
        Application.Sheets(xSheetName).Select
    End If
End If
Application.Sheets(xSheetName).Visible = True
Application.EnableEvents = True
End Sub

doc-proteger-hojas-ocultas-07

Note: En el código anterior, Sheet1 de las xSheetName = "Hoja1" script es el nombre oculto de la hoja de trabajo que desea proteger, y 123456 existentes Si respuesta = "123456", entonces script es la contraseña que establece para la hoja oculta. Puede cambiarlos según sus necesidades.

4. Ahora, cuando desee mostrar la hoja oculta, aparecerá un cuadro emergente que le permitirá ingresar la contraseña. Y este cuadro de aviso aparecerá cada vez que haga clic para mostrar la hoja oculta.

doc-proteger-hojas-ocultas-08


Proteja varias hojas de trabajo a la vez con Kutools para Excel

Si desea proteger varias hojas de trabajo seleccionadas o todas las hojas de trabajo de un libro a la vez, normalmente, debe proteger una por una manualmente en Excel. Pero, si tienes Kutools for Excel, Con su Proteger la hoja de trabajo utilidad, puede protegerlos con un clic.

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

Después de instalar Kutools for Excel, haga lo siguiente:

1. Hacer clic Kutools Más > Proteger la hoja de trabajo, ver captura de pantalla:

2. En la Proteger la hoja de trabajo cuadro de diálogo, todas las hojas de trabajo dentro del libro de trabajo se enumeran en el cuadro de lista, elija las hojas de trabajo que desea proteger. Ver captura de pantalla:

doc-proteger-hojas-ocultas-010

3. Y luego haz clic OK, en el siguiente cuadro de diálogo, ingrese su contraseña y vuelva a escribirla, luego haga clic en OK, aparecerá otro cuadro emergente para recordarle cuántas hojas de trabajo se han protegido.

doc-proteger-hojas-ocultas-011

4. Luego haga clic OK para cerrar los cuadros de diálogo, y todas las hojas de trabajo del libro de trabajo se han protegido con la misma contraseña.

Nota: Si desea desproteger todas las hojas de trabajo a la vez, solo necesita hacer clic en Kutools Más > Desproteger hoja de trabajoy escriba su contraseña para cancelar la protección.

 ¡Descargue y pruebe Kutools para Excel ahora!


Artículos relacionados:

¿Cómo proteger varias hojas de trabajo a la vez en Excel?

¿Cómo establecer una contraseña para proteger el libro de trabajo?

¿Cómo proteger / bloquear el código VBA en Excel?

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 (10)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
jak ktoś ukrył arkusz jak w opisanym pierwszym sposobie, a nie znamy hasła to jak odkryć arkusz skoro hasło do visual basic jest w ukrytym arkuszu?
This comment was minimized by the moderator on the site
Hello, ciekawa

Sorry, at present, there is no good way for canceling the protect of the hidden sheet if you forget the password.

But, you can apply the Uhide all hidden sheets feature of Kutools for Excel to unhide all the hidden sheets without any password.
https://www.extendoffice.com/images/stories/comments/comment-skyyang/doc-unhide-sheets.png
You can download Kutools for Excel and use it freely for 30 days.
Please have a try. Thank you!
This comment was minimized by the moderator on the site
This is elegant. IF the person opening the spreadsheet does not enable macros (i.e. VBA) what happens? Is the hidden sheet a sitting duck? Or is it quite impossible to find?
This comment was minimized by the moderator on the site
Hi, David,
If you open the workbook without enabling the macro, the hidden sheet is displayed as normal. In this case, I recommend you to apply the first method for solving this job.
Thank you!
This comment was minimized by the moderator on the site
Your code allows users to view the sheet as long as they hold the left mouse button while the mouse pointer is on the tab. Try this to keep sheet hidden until correct password is entered: If response = "123456" Then Application.Sheets(xSheetName).Visible = True Application.Sheets(xSheetName).Select Else Application.Sheets(xSheetName).Visible = False[/b][/b] End If End If Application.EnableEvents = True End Sub
This comment was minimized by the moderator on the site
I have a question about your password restricted worksheet code. You posted the following code which works....what I am looking for is code that will do this with multiple worksheets and multiple passwords within the same workbook. Is this possible? Private Sub Workbook_SheetActivate(ByVal Sh As Object) 'Update 20140925 Dim xSheetName As String xSheetName = "sheet1" If Application.ActiveSheet.Name = xSheetName Then Application.EnableEvents = False Application.ActiveSheet.Visible = False xTitleId = "KutoolsforExcel" response = Application.InputBox("Password", xTitleId, "", Type:=2) If response = "123456" Then Application.Sheets(xSheetName).Visible = True Application.Sheets(xSheetName).Select End If End If Application.Sheets(xSheetName).Visible = True Application.EnableEvents = True End Sub
This comment was minimized by the moderator on the site
Found a solution yet?

I am having the same problem
This comment was minimized by the moderator on the site
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim aSheetName As String
Dim bSheetName As String
Dim cSheetName As String
aSheetName = "sheet1"
bSheetName = "sheet2"
cSheetName = "sheet3"

If Application.ActiveSheet.Name = aSheetName Then
Application.EnableEvents = False
Application.ActiveSheet.Visible = False
xTitleId = "KutoolsforExcel"
response = Application.InputBox("Password", xTitleId, "", Type:=2)
If response = "123" Then
Application.Sheets(aSheetName).Visible = True
Application.Sheets(aSheetName).Select
Else
Application.Sheets(aSheetName).Visible = False
End If
End If
Application.EnableEvents = True

If Application.ActiveSheet.Name = bSheetName Then
Application.EnableEvents = False
Application.ActiveSheet.Visible = False
xTitleId = "KutoolsforExcel"
response = Application.InputBox("Password", xTitleId, "", Type:=2)
If response = "456" Then
Application.Sheets(bSheetName).Visible = True
Application.Sheets(bSheetName).Select
Else
Application.Sheets(bSheetName).Visible = False
End If
End If
Application.EnableEvents = True

If Application.ActiveSheet.Name = cSheetName Then
Application.EnableEvents = False
Application.ActiveSheet.Visible = False
xTitleId = "KutoolsforExcel"
response = Application.InputBox("Password", xTitleId, "", Type:=2)
If response = "789" Then
Application.Sheets(cSheetName).Visible = True
Application.Sheets(cSheetName).Select
Else
Application.Sheets(cSheetName).Visible = False
End If
End If
Application.EnableEvents = True

End Sub
This comment was minimized by the moderator on the site
Thanks for the code, just have one question. When you open the sheet you are asked for question, then you enter it and the sheet is visible, but when you jump to next sheet and try to re-open previous sheet, you are asked for the same password again everytime. My question is can you bypass that and make excel ask for password once?
This comment was minimized by the moderator on the site
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim xSheetName As String
aSheetName = "sheet1"
bSheetName = "sheet2"
cSheetName = "sheet3"

If Application.ActiveSheet.Name = aSheetName Then
Application.EnableEvents = False
Application.ActiveSheet.Visible = False
xTitleId = "KutoolsforExcel"
response = Application.InputBox("Password", xTitleId, "", Type:=2)
If response = "1234" Then
Application.Sheets(aSheetName).Visible = True
Application.Sheets(aSheetName).Select
Else
Application.Sheets(aSheetName).Visible = False
End If
End If
Application.EnableEvents = True

If Application.ActiveSheet.Name = bSheetName Then
Application.EnableEvents = False
Application.ActiveSheet.Visible = False
xTitleId = "KutoolsforExcel"
response = Application.InputBox("Password", xTitleId, "", Type:=2)
If response = "2345" Then
Application.Sheets(bSheetName).Visible = True
Application.Sheets(bSheetName).Select
Else
Application.Sheets(bSheetName).Visible = False
End If
End If
Application.EnableEvents = True

If Application.ActiveSheet.Name = cSheetName Then
Application.EnableEvents = False
Application.ActiveSheet.Visible = False
xTitleId = "KutoolsforExcel"
response = Application.InputBox("Password", xTitleId, "", Type:=2)
If response = "3456" Then
Application.Sheets(cSheetName).Visible = True
Application.Sheets(cSheetName).Select
Else
Application.Sheets(cSheetName).Visible = False
End If
End If
Application.EnableEvents = True

End Sub
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations