Error 91 variable de objeto o bloque with no establecido
publicado
Hola a todos,
Estaba trabajando en mi Libro de excel cuando de un momento a otro el userform que habia creado dejo de funcionar, no entiendo que pasa, primero decia que era Error 9 y despues dice que es Error 91.
Cuando le doy Depurar me señala la linea para buscar la celda libre. Adjunto el archivo de excel. Muchas gracias.
Hola a todos,
Estaba trabajando en mi Libro de excel cuando de un momento a otro el userform que habia creado dejo de funcionar, no entiendo que pasa, primero decia que era Error 9 y despues dice que es Error 91.
Cuando le doy Depurar me señala la linea para buscar la celda libre. Adjunto el archivo de excel. Muchas gracias.
Este es el codigo
Private Sub AddexpenseButton_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("EX")
'find first empty row in database
iRow = ws.Range("B:H").Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'check for the amount box empty
If Trim(Me.AccountBox1.Value) = "" Then
Me.AccountBox1.SetFocus
MsgBox "Please enter the account number"
Exit Sub
End If
If Trim(Me.EvenBox2.Value) = "" Then
Me.EvenBox2.SetFocus
MsgBox "Please enter the event"
Exit Sub
End If
If Trim(Me.TypeBox3.Value) = "" Then
Me.TypeBox3.SetFocus
MsgBox "Please enter the type invoice or receipt"
Exit Sub
End If
If Trim(Me.OwnerBox4.Value) = "" Then
Me.OwnerBox4.SetFocus
MsgBox "Please enter the money owner"
Exit Sub
End If
If Trim(Me.DateBox1.Value) = "" Then
Me.DateBox1.SetFocus
MsgBox "Please enter the date of the receipt or invoice"
Exit Sub
End If
If Trim(Me.AmountBox2.Value) = "" Then
Me.AmountBox2.SetFocus
MsgBox "Please enter an amount"
Exit Sub
End If
ws.Cells(iRow, 1).Value = Me.AccountBox1.Value
ws.Cells(iRow, 2).Value = Me.EvenBox2.Value
ws.Cells(iRow, 3).Value = Me.TypeBox3.Value
ws.Cells(iRow, 4).Value = Me.OwnerBox4.Value
ws.Cells(iRow, 5).Value = Me.DateBox1.Value
ws.Cells(iRow, 6).Value = Me.AmountBox2.Value
'clear the data
Me.AccountBox1.Value = ""
Me.EvenBox2.Value = ""
Me.TypeBox3.Value = ""
Me.OwnerBox4.Value = ""
Me.DateBox1.Value = ""
Me.AmountBox2.Value = ""
Me.AccountBox1.SetFocus
End Sub
Private Sub CloseButton_Click()
Unload Me
End Sub
CIRC Macro.rar