Hola @RubenDario
Faltaría que en cada línea dentro del With le pongas un punto al inicio
With Hoja1
.Range("B6:B18,F6:F18,J6:J18").Select
.Range("J6").Activate
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
.Selection.ClearContents
.Range("A1").Select
End With
Sin embargo, lo que yo haría (si fuese mi proyecto)... te ofrezco varias soluciones.
No asignarlo a una combinación de teclas, mejor ponerlo en una forma o botón.
Modificar tu libro con la app Custom UI Editor o similar y adicionar un botón en el Ribbon, estará visible solo cuando el libro esté activo.
Al principio de tu código pondría algo como: If Thisworkbook.Name <> ActiveWorkbook.Name Then Exit sub
Por
DiegoPC, · publicado
Con la siguiente macro oculto todas las celdas en blanco y al final debería de volver a bloquear pero no lo hace , cual puede ser el error
Gracias
Sub Desbloquear()
Sheets("Peticion_Ensayos_TALLER").Select 'Selecciona la Hoja1
ActiveSheet.Unprotect 'Desprotege la hoja activa. Sin contraseña
End Sub
Public Sub OcultarLineasVaciasPeticionEnsayos_TALLER()
Desbloquear
Dim rng As Range
Dim intLastCol As Integer
Dim intLastRow As Integer
Dim blnEmptyRow As Boolean
Dim i As Integer
Dim j As Integer
Set rng = Selection.SpecialCells(xlCellTypeLastCell)
intLastCol = rng.Column
intLastRow = rng.Row
For i = 1 To intLastRow
blnEmptyRow = True
For j = 1 To intLastCol
If Cells(i, j).Value <> "" Then
blnEmptyRow = False
Exit For
End If
Next
If blnEmptyRow Then
Cells(i, j).EntireRow.Hidden = True
End If
Next
End Sub
Sub Protejer()
Sheets("Peticion_Ensayos_TALLER").Select 'Selecciona la Hoja1
ActiveSheet.Protect 'Protege la hoja activa.
End Sub