Modificar macro ingreso de datos en excel

Todos tengo una consulta en mi hoja de excel ingreso datos con un botón en celdas C16 HACIA G16 llenando filas hacia abajo hasta c45 hacia g45 el problema que se me presenta al borrar datos en mi hoja y volver a ingresar datos solo me llena la celda E16 hasta E45 esta es la macro les agradezco su tiempo y atención saludos juan manuel galvan

Private Sub LSTART_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Application.ScreenUpdating = False
On Error GoTo ERR1:
L = LSTART.List(LSTART.ListIndex, 0)
Sheets("ART").Select
Range("A2").Select

While ActiveCell.Value <> "" And ActiveCell.Value <> Val(L) And ActiveCell.Value <> L
ActiveCell.Offset(1, 0).Select
Wend

If ActiveCell.Value = "" Then
MsgBox "NO EXISTE PRODUCTO"
Unload Me
FRMBUSCARCLIENTE.Show
Else
ActiveCell.Offset(0, 1).Select
NOMB1 = ActiveCell.Value

If DON2 = "MODART" Then

Sheets("PRINCIPAL").Select
Range("C6").Select
DON3 = L

Unload Me

FRMARTNUEVO.Show

Else

If DON = "PRINCIPAL" Then
Sheets("PRINCIPAL").Select
Range("C13").Select
While ActiveCell.Value <> ""
ActiveCell.Offset(1, 0).Select
Wend
ActiveCell.Value = NOMB1
End If

If DON = "COTIZACION" Then
Sheets("COTIZACION").Select
Range("D16").Select
While ActiveCell.Value <> ""
ActiveCell.Offset(1, 0).Select
Wend
ActiveCell.Value = NOMB1
End If

End If

If CHBVARIOS = False Then
Unload Me
End If

End If
ERR1:
Application.ScreenUpdating = True
End Sub

Private Sub TXTBUSCAART_Change()
Application.ScreenUpdating = False
Sheets("ART").Select
Range("B2").Select
LSTART.Clear
While ActiveCell.Value <> ""
M = InStr(1, ActiveCell.Value, UCase(TXTBUSCAART.Text))
If M > 0 Then
LSTART.ColumnCount = 6
LSTART.AddItem
ActiveCell.Offset(0, -1).Select
LSTART.List(LSTART.ListCount - 1, 0) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LSTART.List(LSTART.ListCount - 1, 1) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LSTART.List(LSTART.ListCount - 1, 2) = ActiveCell.Value
ActiveCell.Offset(0, 2).Select
LSTART.List(LSTART.ListCount - 1, 3) = Replace(Val(ActiveCell.Value), ",", ".")
ActiveCell.Offset(0, 3).Select
LSTART.List(LSTART.ListCount - 1, 4) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LSTART.List(LSTART.ListCount - 1, 5) = ActiveCell.Value
ActiveCell.Offset(0, -7).Select
End If
ActiveCell.Offset(1, 0).Select

Wend

Sheets(DON).Select
Range("A1").Select

Application.ScreenUpdating = True
End Sub

Private Sub TXTBUSCAART2_Change()
Application.ScreenUpdating = False
Sheets("ART").Select
Range("A2").Select
LSTART.Clear
While ActiveCell.Value <> ""
M = InStr(1, ActiveCell.Value, UCase(TXTBUSCAART2.Text))
If M > 0 Then
LSTART.ColumnCount = 6
LSTART.AddItem
LSTART.List(LSTART.ListCount - 1, 0) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LSTART.List(LSTART.ListCount - 1, 1) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LSTART.List(LSTART.ListCount - 1, 2) = ActiveCell.Value
ActiveCell.Offset(0, 2).Select
LSTART.List(LSTART.ListCount - 1, 3) = Replace(Val(ActiveCell.Value), ",", ".")
ActiveCell.Offset(0, 3).Select
LSTART.List(LSTART.ListCount - 1, 4) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LSTART.List(LSTART.ListCount - 1, 5) = ActiveCell.Value
ActiveCell.Offset(0, -8).Select
End If
ActiveCell.Offset(1, 0).Select

Wend

Sheets(DON).Select
Range("A1").Select

Application.ScreenUpdating = True
End Sub

Private Sub UserForm_Activate()
Application.ScreenUpdating = False
Range("A1").Select
DON = ActiveCell.Value

If DON2 = "MODART" Then
CHBVARIOS.Enabled = False
End If

Sheets("ART").Select
Range("A2").Select

While ActiveCell.Value <> ""

ActiveCell.Offset(0, 5).Select

If DON2 <> "MODART" Then

If ActiveCell.Value = 1 Then
ActiveCell.Offset(0, -5).Select
LSTART.ColumnCount = 6
LSTART.AddItem
LSTART.List(LSTART.ListCount - 1, 0) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LSTART.List(LSTART.ListCount - 1, 1) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LSTART.List(LSTART.ListCount - 1, 2) = ActiveCell.Value
ActiveCell.Offset(0, 2).Select
LSTART.List(LSTART.ListCount - 1, 3) = Replace(Val(ActiveCell.Value), ",", ".")
ActiveCell.Offset(0, 3).Select
LSTART.List(LSTART.ListCount - 1, 4) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LSTART.List(LSTART.ListCount - 1, 5) = ActiveCell.Value
ActiveCell.Offset(1, -8).Select
Else
ActiveCell.Offset(1, -5).Select
End If

Else

ActiveCell.Offset(0, -5).Select
LSTART.ColumnCount = 6
LSTART.AddItem
LSTART.List(LSTART.ListCount - 1, 0) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LSTART.List(LSTART.ListCount - 1, 1) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LSTART.List(LSTART.ListCount - 1, 2) = ActiveCell.Value
ActiveCell.Offset(0, 2).Select
LSTART.List(LSTART.ListCount - 1, 3) = Replace(Val(ActiveCell.Value), ",", ".")
ActiveCell.Offset(0, 3).Select
LSTART.List(LSTART.ListCount - 1, 4) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
LSTART.List(LSTART.ListCount - 1, 5) = ActiveCell.Value
ActiveCell.Offset(1, -8).Select

End If

Wend

Sheets(DON).Select
Range("A1").Select

Application.ScreenUpdating = True
End Sub

Añade tu respuesta

Haz clic para o