El IF no responde
Publicado por Lunnaticoo (2 intervenciones) el 18/10/2007 15:10:16
Holas..
Resulta que estoy haciendo una macros super simple en la cual tengo que buscar un rango determinado de balores, para eso uso un IF para crear la condicion, pero este no me responde..
mi codigo es el siguiente..
Private Sub CommandButton1_Click()
If TextBox1 <> "" Then
If TextBox2 <> "" Then
limpiar
x = 1
Hoja1.Activate
Range("Hoja1!a5").Select
Do While ActiveCell <> Empty
ActiveCell.Offset(1, 0).Select
If (ActiveCell >= TextBox1 And ActiveCell <= TextBox2) Then 'Rem <<<< aqui es donde no responde, si remplaso los textbox por numeros entra al IF, Que esta mal ??
fila = ActiveCell.Row
x = x + 1
For i = 1 To 12
dato = Hoja1.Cells(fila, i)
Hoja2.Cells(x, i) = dato
Next i
End If
Loop
UserForm1.Hide
Hoja2.Activate
Else
MsgBox "Falta Ingresar una Fecha de Termino", vbInformation, "Error"
TextBox2.SetFocus
End If
Else
MsgBox "Falta Ingresar una Fecha de Inicio", vbInformation, "Error"
TextBox1.SetFocus
End If
End Sub
Function limpiar()
Hoja2.Activate
Range("Hoja2!a2").Select
Do While ActiveCell <> Empty
ActiveCell.Offset(1, 0).Select
filas = filas + 1
Loop
For x = 2 To filas + 1
For y = 1 To 12
Hoja2.Cells(x, y) = ""
Next y
Next x
End Function
Gracias !!!
Resulta que estoy haciendo una macros super simple en la cual tengo que buscar un rango determinado de balores, para eso uso un IF para crear la condicion, pero este no me responde..
mi codigo es el siguiente..
Private Sub CommandButton1_Click()
If TextBox1 <> "" Then
If TextBox2 <> "" Then
limpiar
x = 1
Hoja1.Activate
Range("Hoja1!a5").Select
Do While ActiveCell <> Empty
ActiveCell.Offset(1, 0).Select
If (ActiveCell >= TextBox1 And ActiveCell <= TextBox2) Then 'Rem <<<< aqui es donde no responde, si remplaso los textbox por numeros entra al IF, Que esta mal ??
fila = ActiveCell.Row
x = x + 1
For i = 1 To 12
dato = Hoja1.Cells(fila, i)
Hoja2.Cells(x, i) = dato
Next i
End If
Loop
UserForm1.Hide
Hoja2.Activate
Else
MsgBox "Falta Ingresar una Fecha de Termino", vbInformation, "Error"
TextBox2.SetFocus
End If
Else
MsgBox "Falta Ingresar una Fecha de Inicio", vbInformation, "Error"
TextBox1.SetFocus
End If
End Sub
Function limpiar()
Hoja2.Activate
Range("Hoja2!a2").Select
Do While ActiveCell <> Empty
ActiveCell.Offset(1, 0).Select
filas = filas + 1
Loop
For x = 2 To filas + 1
For y = 1 To 12
Hoja2.Cells(x, y) = ""
Next y
Next x
End Function
Gracias !!!
Valora esta pregunta


0