Saltar al contenido

Boton Guardar

publicado

Buenas tardes,

Estoy seguro que me podran ayudar con esto tengo un problema con el boton guardar, es para un historial de facturas no me resulta nose si alguien lo puede revisar y me dice que pasa dejo el documento anexo en la hoja datos esta el programita.

Dim i As IntegerSheets("Datos").Activate ' activamos la hoja en la que vamos a trabajar

If Trim(Range("C2").Value) = "" Then ' localizamos la celda en donde vamos a empezar a insertar

Range("C2").Activate

Else

Range("C1").End(xlDown)(xlDropDown).Activate

End If

ActiveCell.Value = Me.txtCliente.Text ' insertamos los datos

ActiveCell.Next.Value = Me.TextBox3.Text

ActiveCell.Next.Next.Value = Me.TextBox3.Text

For i = 0 To Me.lstcantidad.ListCount

ActiveCell.Next.Next.Next.Value = Me.lstproducto.List(i)

ActiveCell.Next.Next.Next.Next.Value = Me.lstcantidad.List(i)

ActiveCell.Next.Next.Next.Next.Next.Value = Me.lstprecio.List(i)

ActiveCell.Next.Next.Next.Next.Next.Next.Value = Me.lstimporte.List(i)

Next

es para guaradar un registro de ventas gracias.

cotizacion victor 1.rar

Featured Replies

publicado

Antes de mirarlo más te digo que el bucle for debe llegar hasta .listcount-1... y limpiaría un poco el código de tanto next, mejor usar offset... bueno cuando tenga un rato te lo miro. Un Saludo

- - - - - Mensaje combinado - - - - -

Prueba este codigo a ver si te vale




Dim i As Integer
Dim Ultima As Long
Dim Offset As Integer

Application.ScreenUpdating = False

Sheets("Datos").Activate ' activamos la hoja en la que vamos a trabajar

Ultima = Columns(3).Rows(Rows.Count).End(xlUp).Row + 1


Cells(Ultima, 1) = Ultima - 1 [COLOR=#ff0000]' NO SE SI ESTE SERÁ TU "ID"[/COLOR]
Cells(Ultima, 3).Value = Me.txtCliente.Text ' insertamos los datos
Cells(Ultima, 4).Value = Me.TextBox3.Text
Cells(Ultima, 2).Value = Me.TextBox1.Text

For i = 0 To Me.lstcantidad.ListCount - 1
Offset = i * 4
Cells(Ultima, 5 + Offset).Value = Me.lstproducto.List(i)
Cells(Ultima, 6 + Offset).Value = Me.lstcantidad.List(i)
Cells(Ultima, 7 + Offset).Value = Me.lstprecio.List(i)
Cells(Ultima, 8 + Offset).Value = Me.lstimporte.List(i)
Next

Application.ScreenUpdating = True



[/CODE]

publicado
  • Autor

Nachobm muchas gracia por tu aporter me sirvbio a la perfeccion.

Ahora quisiera saber como hacer el inverso ya que este es como. Una notas de pedidos donde guardare pedidos de clientes pero tmb quiero tenrlos disponibles para poder facturarlos gracias

publicado

Ok, en un rato te lo paso

- - - - - Mensaje combinado - - - - -

Prueba y si tienes alguna duda o quieres algún cambio, ya sabes

cotizacion victor 1.zip

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.