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 celdas menos una despues de registro

publicado

Buenas! como están?, tengo una macro que me pide una contraseña al abrir el libro y si pongo correctamente la contraseña me deja acceder al libro y lo registra en una hoja, con el nombre de usuario de PC y serie de disco duro. hasta aquí todo perfecto pero me gustaría que este libro solo se pueda usar en una sola computadora, al dar la contraseña lo podrían utilizar en N computadoras ya que se seguiría registrando, a lo cual se me ocurrió bloquear todas las demás celdas menos la que tiene el primer registro y en caso de que intenten registrar otra maquina el libro se cierre. la macro es la siguiente :

Dim CerrarFormulario As Boolean

Private Sub UserForm_QueryClose(Cancel As Integer, ModoCerrar As Integer)

'EVITO QUE EL USUARIO DE A LA (X) DEL FORMULARIO PARA CERRARLO Y OBLIGO A QUE INSERTE UNA CONTRASEÑA.

If CerrarFormulario = False Then Cancel = True

End Sub

Private Sub txtPassword_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

Dim SerialHD As String

Dim UltRegistro As Integer

If KeyCode = 13 Then

With CreateObject("Scripting.FileSystemObject")

SerialHD = Hex(.Drives.Item("C:").SerialNumber)

End With

UltRegistro = Hoja2.Range("B" & Rows.Count).End(xlUp).Row

'EL USUARIO A PULSADO LA TECLA ENTER

If Len(txtPassword) > 0 Then

If txtPassword = "Dr4gonnike01" Then

msg = MsgBox("¿Desea insertar al siguiente Usuario al listado de Autorizados?" & vbCrLf & vbCrLf & "Usuario: " & SerialHD, vbQuestion + vbYesNo, "Autorizaciones")

If msg = vbYes Then

If UltRegistro > 2 Then

Hoja2.Range("B" & UltRegistro + 1) = SerialHD 'SERIAL DEL DISCO DURO

Hoja2.Range("C" & UltRegistro + 1) = Environ("username") 'NOMBRE DE USUARIO

Else

Hoja2.Range("B3") = SerialHD 'SERIAL DEL DISCO DURO

Hoja2.Range("C3") = Environ("username") 'NOMBRE DE USUARIO

End If

CerrarFormulario = True

Unload Me

Else

CerrarFormulario = True

Unload Me 'CIERRO EL FORMULARIO

End If

Else

CerrarFormulario = True

Unload Me 'CIERRO EL FORMULARIO

ThisWorkbook.Close False 'CIERRO EL PROGRAMA SIN GUARDAR LOS CAMBIOS

End If

End If

End If

End Sub

si pudieran ayudarme por favor, estaría muy agradecido con su colaboracion

Libro.zip

Featured Replies

publicado

Hola [uSER=175702]@danielhf[/uSER] ; de acuerdo a las normas del foro se hace necesario que aportes un archivo de excel con lo que tienes.

Saludos.

publicado
  • Autor

Justo lo estaba agregando, mil disculpas

Está en el primer post

publicado
  • Autor

[uSER=140867]@jonetoja[/uSER]. Alguien me podría ayudar con esta pequeña solicitud por favor?. felices fiestas compañeros.

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.