Integrar macros, proteger y compartir libro, y color de celda
Para Elsa:
Hola Elsa, nuevamente molestándote estoy tratando de incorporar esta macros con la anterior que me ayudaste a hacer (adjunto código de la anterior), Si es posible me ayudarías a saber como poner el color gris a las celdas que se protegen.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 And Target.Count = 1 Then
'se desprotege la hoja
ActiveSheet.Unprotect Password = "microft"
If Target.Value = "LOCAL" Then
Range("D" & Target.Row).Locked = True
Range("F" & Target.Row).Locked = True
Range("G" & Target.Row).Locked = True
ElseIf Target.Value = "FORANEO" Then
Range("G" & Target.Row).Locked = True
ElseIf Target.Value = "EXTRANJERO" Then
'completar
End If
'se vuelve a proteger
ActiveSheet.Protect Password = "microft"
End If
End Subpero en este nuevo proyecto al hacer la lista automática con este otro código
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim xCombox As OLEObject
Dim xStr As String
Dim xWs As Worksheet
Set xWs = Application.ActiveSheet
On Error Resume Next
Set xCombox = xWs.OLEObjects("Tipo")
With xCombox
.ListFillRange = ""
.LinkedCell = ""
.Visible = False
End With
If Target.Validation.Type = 3 Then
Target.Validation.InCellDropdown = False
Cancel = True
xStr = Target.Validation.Formula1
xStr = Right(xStr, Len(xStr) - 1)
If xStr = "" Then Exit Sub
With xCombox
.Visible = True
.Left = Target.Left
.Top = Target.Top
.Width = Target.Width + 1
.Height = Target.Height + 1
.ListFillRange = xStr
.LinkedCell = Target.Address
End With
xCombox.Activate
Me.Tipo.DropDown
End If
End Sub
Private Sub TipoCta_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Select Case KeyCode
Case 9
Application.ActiveCell.Offset(0, 1).Activate
Case 13
Application.ActiveCell.Offset(0, 1).Activate
Case 37 'flecha izquierda
Application.ActiveCell.Offset(0, -1).Activate
Case 39 'flecha derecha
Application.ActiveCell.Offset(0, 1).Activate
End Select
End Subme pasa los siguiente:
1 no se como incorporar los 2 códigos
2 al ejecutar este ultimo y proteger y compartir el libro se queda pegada la un cuadro en la pantalla

3 al tratar de desbloquear la hoja ya no me acepta la contraseña "1234"
Te comparto el archivo
https://www.dropbox.com/s/vxjdvs0ebjg4dnz/Envios%20Base.xlsm?dl=0
1 Respuesta
Respuesta de Elsa Matilde
1