Corrección macro que genera problema con variable
Para Dante Amor
Hola de nuevo:
Continuando con las consultas que le he venido formulando, el siguiente formulario a revisar es "Informes", presenta la misma situación del limite de 30000.
El siguiente es el código:
'Informe Stock actual
Private Sub CommandButton1_Click()
Dim nuevo As Object
Dim ORIGEN As String
Dim i As Integer
Dim j As Integer
Dim final As Integer
Dim VALOR As String
Application.ScreenUpdating = False
Set nuevo = Workbooks.Add
nuevo.Activate
ORIGEN = ActiveWorkbook.Name
For i = 1 To 30000
If Hoja6.Cells(i, 1) = "" Then
final = i - 1
Exit For
End If
Next
VALOR = Hoja6.Cells(1, 1)
For j = 1 To final
'Datos para el reporte
Application.Workbooks(ORIGEN).Worksheets(1).Cells(1, 1) = "INFORME STOCK ACTUAL DE TODOS LOS PRODUCTOS"
Application.Workbooks(ORIGEN).Worksheets(1).Cells(j + 2, 1) = Hoja6.Cells(j, 1) 'Código
Application.Workbooks(ORIGEN).Worksheets(1).Cells(j + 2, 2) = Hoja6.Cells(j, 2) 'Descripción
Application.Workbooks(ORIGEN).Worksheets(1).Cells(j + 2, 3) = Hoja6.Cells(j, 4) 'Cantidad
Application.Workbooks(ORIGEN).Worksheets(1).Cells(j + 2, 4) = Hoja6.Cells(j, 5) 'Costo unitario
Application.Workbooks(ORIGEN).Worksheets(1).Cells(j + 2, 5) = Hoja6.Cells(j, 6) 'Costo Total
Next