Error de programa
Publicado por Cesar (3 intervenciones) el 09/12/2005 13:48:51
Hola,
He programado con mucho esfuerzo estas pocas lineas, ya que yo no programo en VB.
el tema que esta macro busca un codigo automaticamente en la ultima hoja del libro de excel.
toma codigo por codigo de un rango especifico de cada hoja y al terminar salta a la hoja siguiente,
MI PROBLEMA RADICA QUE DA ERROR AL BUSCAR UN CODIGO QUE NO EXISTE, DA ERROR 91 VARIABLE DE OBJETO O BLOQUE WITH NO ESTABLECIDO
Esta es la macro que arme, si me pueden dar una mano, o purificar este fuente se los agradeceria eternamente,
Un abrazo
Cesar
Argentina
Dim Datos As Object
Dim Rango As Range
Set Datos = Sheets("Ferreteria")
Set Rango = Sheets("Ferreteria").Columns("A:A")
Cantidad = (Sheets.Count) - 2
Columna = 2
For A = 1 To Cantidad
Sheets(A).Select
For B = 11 To 102
AuxCodigo = Cells(B, Columna)
If Not IsEmpty(AuxCodigo) Then
Datos.Select
Rango.Select
AuxPrecio = 0
---------------- en la linea de abajo esta el error ---------------
Selection.Find(What:=AuxCodigo, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=True).Activate
--------------------------------------------------------------------------
AuxPrecio = Cells(ActiveCell.Row, 3)
Sheets(A).Select
ActiveSheet.Cells(B, (Columna + 2)) = AuxPrecio
End If
Application.ScreenUpdating = False
If B = 102 Then
If Columna = 7 Then
Columna = 2
B = 200
Else
B = 11
Columna = 7
End If
End If
Next
MsgBox (ActiveSheet.Name)
Next
Application.ScreenUpdating = False
End Sub
He programado con mucho esfuerzo estas pocas lineas, ya que yo no programo en VB.
el tema que esta macro busca un codigo automaticamente en la ultima hoja del libro de excel.
toma codigo por codigo de un rango especifico de cada hoja y al terminar salta a la hoja siguiente,
MI PROBLEMA RADICA QUE DA ERROR AL BUSCAR UN CODIGO QUE NO EXISTE, DA ERROR 91 VARIABLE DE OBJETO O BLOQUE WITH NO ESTABLECIDO
Esta es la macro que arme, si me pueden dar una mano, o purificar este fuente se los agradeceria eternamente,
Un abrazo
Cesar
Argentina
Dim Datos As Object
Dim Rango As Range
Set Datos = Sheets("Ferreteria")
Set Rango = Sheets("Ferreteria").Columns("A:A")
Cantidad = (Sheets.Count) - 2
Columna = 2
For A = 1 To Cantidad
Sheets(A).Select
For B = 11 To 102
AuxCodigo = Cells(B, Columna)
If Not IsEmpty(AuxCodigo) Then
Datos.Select
Rango.Select
AuxPrecio = 0
---------------- en la linea de abajo esta el error ---------------
Selection.Find(What:=AuxCodigo, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=True, SearchFormat:=True).Activate
--------------------------------------------------------------------------
AuxPrecio = Cells(ActiveCell.Row, 3)
Sheets(A).Select
ActiveSheet.Cells(B, (Columna + 2)) = AuxPrecio
End If
Application.ScreenUpdating = False
If B = 102 Then
If Columna = 7 Then
Columna = 2
B = 200
Else
B = 11
Columna = 7
End If
End If
Next
MsgBox (ActiveSheet.Name)
Next
Application.ScreenUpdating = False
End Sub
Valora esta pregunta


0