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.

Macros para bloquear celdas + botón

publicado

Hola pueden ayudarme con pequeño ejercicio de Excel que también se refiere a bloquear celdas especificas y pueda hacer esto con una macro quisiera que al momento de escribir en la celda D3 las celdas D5, D7, D9 queden bloqueadas o si escribo en la celda D9 las celdas D7, D5y D3 queden bloqueadas, de igual manera con las celdas D7 y D5. No se si me explico

ISC 1.xlsx

Featured Replies

publicado

Imagino que lo que pretendes es que solo pueda informarse un solo valor en el rango D3, D5, D7 y D9.

Cada vez que informes un valor en una celda, se borran los otros tres.

He añadido una validación de los valores que pueden entrarse, revisa a  fondo el archivo adjunto.

Estas son las macros:

Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address(False, False)
   Case "D3": Validar Target, 10
   Case "D5": Validar Target, 2
   Case "D7": Validar Target, 8
   Case "D9": Validar Target, 16
End Select
End Sub

Private Sub Validar(Target, Dígitos)
lista = "0123456789ABCDEF"
valor = CStr(Target)
If Len(valor) > 0 Then
   For x = 1 To Len(valor)
      ok = False
      For y = 1 To Dígitos
         If Mid(valor, x, 1) = Mid(lista, y, 1) Then ok = True
      Next
      If ok = False Then
         MsgBox "Solo se admiten valores: " & Left(lista, Dígitos), vbCritical
         Target = ""
         Target.Select
         Exit Sub
      End If
   Next
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Address(False, False)
   Case "D3": If [D5] <> "" Or [D7] <> "" Or [D9] <> "" Then Borrar
   Case "D5": If [D3] <> "" Or [D7] <> "" Or [D9] <> "" Then Borrar
   Case "D7": If [D3] <> "" Or [D5] <> "" Or [D9] <> "" Then Borrar
   Case "D9": If [D3] <> "" Or [D5] <> "" Or [D7] <> "" Then Borrar
End Select
End Sub

Private Sub Borrar()
If [D3] <> "" Then [D3] = ""
If [D5] <> "" Then [D5] = ""
If [D7] <> "" Then [D7] = ""
If [D9] <> "" Then [D9] = ""
End Sub

 

ISC 1.xlsm

publicado

La macro de evento Worksheet_SelectionChange puede sustituirse por esta un poco mas "pro": ?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("D3,D5,D7,D9")) Is Nothing Then Borrar
End Sub

 

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.