Entra en estructura If que esta vacia
Hola tengo el sigueinte codigo
Sheets("Hoja1").Select
With Selection
Dim UltimaFila As Integer
UltimaFila = Range("B1048576").End(xlUp).Row
Cells(UltimaFila, 3).Select
If ActiveCell.Value <> "" And IsNumeric(ActiveCell.Value) Then
Dim Borra, AuxFB, dias, dia2, mes, mes2, año, Ffinal, linea As String
Borra = ActiveCell.Value
Cells(UltimaFila, 4).Select
dias = Day(ActiveCell.Value)
dia2 = Format(dias, "00")
mes = Month(ActiveCell.Value)
mes2 = Format(mes, "00")
año = Year(ActiveCell.Value)
dia = Weekday(dias, vbMonday)
Ffinal = año & mes2 & dia2
Dim busco As Object
On Error Resume Next
Set busco = Sheets("incidencia").Range("B2:B1048576").Find(val(Ffinal))
If busco <> Empty Then
linea = busco.Row
'MsgBox linea
Cells(linea, 4).Select
Dim borra2, total2 As String
borra2 = ActiveCell.Value
ActiveCell.vaule = borra2 - Borra
Else
MsgBox "NADA"
total = total - Borra
TotalI = TotalI - Borra
ActiveCell.EntireRow.Delete 'Elimina la ultima fila
End If
'MsgBox Borra
' MsgBox total
total = total - Borra
TotalI = TotalI - Borra
' MsgBox total
ActiveCell.EntireRow.Delete 'Elimina la ultima fila
Else
MsgBox "No Se Puede Borrar Esta Fila", vbSystemModal + vbCritical, "Advertencia"
End If
End With
UltimaGuia = 0
Viaje = Viaje - 1
Conta = Conta - 1En la parte donde dice If busco <> Empty Then siempre entra a esta estructura asi la variable busco sea vacio... Alguno sabe el porque?
Respuesta de Elsa Matilde
2