Excel - ERROR 91

 
Vista:

ERROR 91

Publicado por MOISES (7 intervenciones) el 04/06/2010 16:55:26
TENGO EL SIGUIENTE CODIGO QUE BUSCA LOS DATOS VACIADOS EN UNA TABLA DE EXCEL, MIENTRAS LOS DATOS ESTAN EN LA TABLA FUNCIONA BIEN PERO CUANDO NO ENCUENTRA LOS DATOS ARROJA UN MENSAJE DE ERROR 91" EN TIEMPO DE EJECUCION, QUISIERA SABER COMO PUEDO HACER PARA QUE CUANDO NO CONSIGA LOS DATOS, SE DEVUELVA AL COMIENZO DE LA INSTRUCCION Y ME PERMITA HACER OTRA BUSQUEDA, DE ANTEMANO AGRADESCO LA AYUDA QUE ME PUEDAN PRESTAR

Private Sub CommandButton1_Click()

Cells.Find(What:=TextBox1, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate

ActiveCell.Offset(0, 1).Select
TextBox2 = ActiveCell

ActiveCell.Offset(0, 1).Select
TextBox3 = ActiveCell

ActiveCell.Offset(0, 1).Select
TextBox4 = ActiveCell

ActiveCell.Offset(0, 1).Select
TextBox5 = ActiveCell

ActiveCell.Offset(0, 1).Select
TextBox6 = ActiveCell

ActiveCell.Offset(0, 1).Select
TextBox7 = ActiveCell
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de JuanC

RE:ERROR 91

Publicado por JuanC (1237 intervenciones) el 05/06/2010 12:56:34
podrías asignar el resultado así
Dim rng As Range
Set rng = Cells.Find(What:=TextBox1, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False)

If Not rng Is Nothing Then
rng.Activate
Else
'goto...
End If

Saludos, desde Baires, JuanC
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar