Como optimizar la entrada de datos del userForm a la hoja de calculo.
y feliz año;
-Mi pregunta es la siguiente
Tengo un formulario "form_Recuento" donde voy añadiendo artículos recontados y estos los voy pasando a las hojas "Recuento" y "Existencias". A medida que el número de registros aumenta tarda mas en registrarlos en dichas hojas.
Este es el código que tengo para el registro.
Saludos y lo dicho feliz año a todos.
Private Sub Registro_Click()
Dim fila As Integer
Dim Final As Integer
Dim ExistenciaRE As Integer
Dim TotalRE As Integer
Dim Comprb As Long
txt_Zona.Enabled = False
Hoja7.Range("A2").Value = Hoja7.Range("A2").Value + 1
Comprb = Hoja7.Range("A2").Value
For fila = 2 To 9000
If Hoja14.Cells(fila, 1) = "" Then
Final = fila
Exit For
End If
Next
Hoja14.Cells(Final, 1) = "RcE-" & Comprb
Hoja14.Cells(Final, 2) = Me.txt_FechaIng
Hoja14.Cells(Final, 3) = Me.txt_Hora
Hoja14.Cells(Final, 4) = Val(Me.ComboBox1)
Hoja14.Cells(Final, 5) = Me.txt_Codigo
Hoja14.Cells(Final, 6) = Me.txt_Nombre
Hoja14.Cells(Final, 7) = Me.txt_Color
Hoja14.Cells(Final, 8) = Val(Me.txt_Cantidad)
Hoja14.Cells(Final, 9) = Hoja8.Range("G1") 'usuario
Hoja14.Cells(Final, 10) = Me.txt_Zona
Hoja14.Cells(Final, 11) = Hoja12.Range("C8") 'Delegaci?n
For fila = 2 To 9000
If Hoja16.Cells(fila, 1) = Hoja14.Cells(Final, 4) Then
ExistenciaRE = Hoja16.Cells(fila, 7)
TotalRE = Me.txt_Cantidad + ExistenciaRE
Hoja16.Cells(fila, 7) = TotalRE
Exit For
End If
Next
Me.ComboBox1 = ""
Me.txt_Nombre = ""
Me.txt_FechaIng = ""
Me.txt_Hora = ""
Me.txt_Cantidad = ""
ComboBox1.SetFocus
End Sub
1 respuesta
Respuesta de Adriel Ortiz Mangia
1


