Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Bloquear celda

publicado

Hola buenas tengo el siguiente problema 

les explico lo que estoy tratando de hacer : basicamente busco que cuando el usuario digite algo  la celda quede  bloqueada cuando cierre el archivo, esta parte ya la logre , lo otro es bloquear la creación de las hoja  lo pude hacer sin problemas.  el problema es que el archivo va ha estar en red y por obligación deben habilitar las macros. 

intente hacer un hoja de inicio ocultando las otras pero el código no me deja. 

este es el codigo : 

Private Sub Workbook_BeforeClose(Cancel As Boolean)

    For Each h In Sheets
        h.Unprotect "abc"
        h.Cells.Locked = False
        h.UsedRange.SpecialCells(xlCellTypeConstants, 23).Locked = True
        h.Protect "abc", DrawingObjects:=False, Contents:=True, Scenarios:=False, _
            AllowFormattingCells:=True, AllowFormattingColumns:=True, AllowFormattingRows:=True, _
            AllowInsertingColumns:=True, AllowInsertingRows:=True, AllowInsertingHyperlinks:=True, _
            AllowDeletingColumns:=True, AllowDeletingRows:=True, AllowSorting:=True, _
            AllowFiltering:=True, AllowUsingPivotTables:=True
    Next
    ThisWorkbook.Save
         
End Sub

 

------

realice un segundo archivo (ejmeplo2) con un codigo con algunos cambios , me funciona bien excepto para las hojas nuevas que cree . 

este codigo si me deja ocultar las otras hoja pero al crear hojas nuevas el codigo no funciona.

 

este es el codigo.

Private Sub Workbook_BeforeClose(Cancel As Boolean)

    
    Set h = Sheets("hoja1")
        h.Unprotect "abc"
        h.Cells.Locked = False
        h.UsedRange.Locked = False
        h.UsedRange.SpecialCells(xlCellTypeConstants, 23).Locked = True
        h.Protect "abc", DrawingObjects:=False, Contents:=True, Scenarios:=False, _
            AllowFormattingCells:=True, AllowFormattingColumns:=True, AllowFormattingRows:=True, _
            AllowInsertingColumns:=True, AllowInsertingRows:=True, AllowInsertingHyperlinks:=True, _
            AllowDeletingColumns:=True, AllowDeletingRows:=True, AllowSorting:=True, _
            AllowFiltering:=True, AllowUsingPivotTables:=True
    
             

Dim hoja As Worksheet
    
    Sheets("inicio").Visible = xlSheetVisible
    
    For Each hoja In ThisWorkbook.Worksheets
        If hoja.Name <> "inicio" Then
            hoja.Visible = xlSheetVeryHidden
        End If
    Next hoja
    
    ActiveWorkbook.Save


End Sub

Private Sub Workbook_Open()
    Dim hoja As Worksheet

    For Each hoja In ThisWorkbook.Worksheets
        hoja.Visible = xlSheetVisible
    Next hoja
    
    Sheets("inicio").Visible = xlSheetVeryHidden
End Sub

les adjunto los archivos.

 

 

Gracias espero me colaboren realmente lo que  quiero es crear un archivo con seguridad , si no habiltan las macros la funcion del archivo no sirve


 

 

 

 

 

 

ejemplo1.xlsm

ejemplo2.xlsm

Featured Replies

No hay posts para mostrar

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.