miércoles, 7 de septiembre de 2011

EVITAR DEJAR UNA CELDA EN BLANCO


Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Row = 1 Then Exit Sub
If Selection.Cells.Count > 1 Then Exit Sub
Application.EnableEvents = False
With Me.Range("A1")
.Value = .Value
End With
On Error GoTo Finish
If Not Target.Row = 1 Then
With Me.Range("A" & Target.Row).SpecialCells(xlCellTypeBlanks)
MsgBox "The range " & .Address(0, 0) & " is still blank"
.Select
End With
End If
Finish:
Application.EnableEvents = True
End Sub

No hay comentarios: