Saltar al contenido

Un textbox en varias celdas para facturacion


Recommended Posts

publicado

Estimados,

Segun el archivo adjunto lo que requiero saber es si es posible que con un textbox se pueda cargar la información (de modo multiline) pero en varias celdas , ya que si ingreso de este modo lo que hace es ir a la misma celda y no una debajo de otra.

Muchas Gracias por su apoyo y tiempo. Saludos

factura.zip

publicado

Hola Amigo, si que también debe agregar al costado de cantidad iría item No., ahora ese cuadro Descripción bebo ingresar Todos los item que deberán estar en las filas indicadas en el ejemplo, espero puedas ayudarme lo apreciaria mucho. Un saludo

publicado

Sería en este orden: Item/cantidad/descripción/unitario/total al ejemplo que me pasas solo le falta item. Y el tipo de moneda sería en esta forma por. Ejemplo: Son diez mil con 00/100 nuevos soles. Es esto posible? Saludos

publicado

Revise tu libro facturas ,solamente insertaste los textbox,listbox,label , la userform no tiene una sola sentencia, adjunto una guía de como empezar.

Private Sub txtDescripcion_Change()

End Sub

Private Sub txtIVA_Change()

End Sub

Private Sub txtNoFactura_Change()

End Sub
Private Sub UserForm_activate()

Me.txtFecha.Text = Date ' para poner la fecha cuando se ejecute el form
Sheets("FACTURAS").Activate

End Sub

Private Sub lblRazon_Click()

End Sub
Private Sub cmdAceptar_Click()
If MsgBox("Realizar la Compra?", vbQuestion + vbYesNo) = vbNo Then Exit Sub
guardarFactura
Cobrar.Show
If Me.chkImprimir.value = True Then ImprimirFactura
End Sub

Private Sub cmdBuscar_Click()
frmBuscarCliente.Show ' mostrar el formulario de buscar clientes
End Sub

Private Sub cmdProductos_Click()
frmAgregarProducto.Show ' mostrar el formulario de agregar productos
End Sub

Private Sub Image2_Click()

End Sub
Private Sub lstDescripcion_Click()

End Sub

Private Sub lstImporte_Click()

End Sub

Private Sub lstPrecio_Click()

End Sub

Private Sub txtLetras_Change()

End Sub

Private Sub txtRazon_Change()

End Sub

Private Sub txtRFC_Change()

Me.txtFecha.Text = Date ' para poner la fecha cuando se ejecute el form


End Sub

Public Sub sumarImporte() ' suma solo la ultima lista, osea, los importes
Dim i As Integer
Dim dTotal As Double
Dim arrTotal As Variant
dTotal = 0
For i = 0 To Me.lstImporte.ListCount - 1
dTotal = dTotal + Val(Me.lstImporte.List(i))
Next
Me.txtSubtotal.Text = dTotal
If dTotal > 0 Then ' aqui se hacen los calculos para el subtotal, iva y total
Me.txtIVA.Text = Round((Val(Me.txtSubtotal.Text) / 100) * 0, 0)
Me.txtTotal.Text = Val(Me.txtSubtotal.Text) + Val(Me.txtIVA.Text)
End If
arrTotal = Split(Me.txtTotal.Text, ".")
If UBound(arrTotal) = 0 Then
Me.txtLetras.Text = "SON: " & Num2Text(arrTotal(0)) & " COLONES"
Else
Me.txtLetras.Text = "SON: " & Num2Text(arrTotal(0)) & " CON " & arrTotal(1) & "Colones."
End If



End Sub

Private Sub guardarFactura()
Dim i As Integer
Sheets("facturas").Activate ' activamos la hoja en la que vamos a trabajar
If Trim(Range("A2").value) = "" Then ' localizamos la celda en donde vamos a empezar a insertar
Range("A2").Activate
Else
Range("A1").End(xlDown)(xlDropDown).Activate
End If

For i = 0 To Me.lstCantidad.ListCount - 1
ActiveCell.value = Me.txtNoFactura.Text ' insertamos los datos
ActiveCell.Next.value = Me.txtFecha.Text
ActiveCell.Next.Next.value = Me.cbcliente.Text
ActiveCell.Next.Next.Next.value = Me.lstDescripcion.List(i)
ActiveCell.Next.Next.Next.Next.value = Me.lstPrecio.List(i)
ActiveCell.Next.Next.Next.Next.Next.value = Me.lstCantidad.List(i)
ActiveCell.Next.Next.Next.Next.Next.Next.value = Me.lstImporte.List(i)
descontarExistencia Me.lstDescripcion.List(i), Val(Me.lstCantidad.List(i))
ActiveCell(xlDropDown).Activate
Next
Me.lstCantidad.Clear
Me.lstImporte.Clear
Me.lstDescripcion.Clear
Me.lstPrecio.Clear
Me.cbcliente.Text = ""
Me.txtSubtotal.Text = ""

End Sub
Private Sub ImprimirFactura() ' esta hace lo mismo pero con la hoja de impresion
Dim i As Integer
Sheets("IMPRESION").Activate
Range("a1:h25").ClearContents
Range("g2").value = Me.txtFecha.Text
Range("C2").value = Me.cbcliente.Text
Range("b8").Select
For i = 0 To Me.lstCantidad.ListCount - 1
ActiveCell.value = Me.lstCantidad.List(i)
ActiveCell.Next.value = Me.lstDescripcion.List(i)
ActiveCell.Next.Next.value = Me.lstPrecio.List(i)
ActiveCell.Next.Next.Next.Next.value = Me.lstPrecio.List(i)
ActiveCell.Next.Next.Next.Next.Next.value = Me.lstImporte.List(i)
ActiveCell(xlDropDown).Activate
Next
Range("g19").value = Me.txtSubtotal.Text
Range("g20").value = Me.txtIVA.Text
Range("g21").value = Me.txtTotal.Text
Range("b20").value = Me.txtLetras.Text
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
End Sub

Private Sub descontarExistencia(ByVal sDescripcion As String, ByVal nCantidad As Integer)
Dim sUltimaCelda As String
Dim hojaActiva As String

hojaActiva = ActiveSheet.Name ' para recordar la hoja activa
Sheets("PRODUCTOS").Activate ' nos pasamos a la hoja de productos

' aqui nomas fijamos los rangos, pa que no marque error si no hay nada en la lista
If Trim(Range("b2").value) <> "" Then
sUltimaCelda = Range("b1").End(xlDown).Address
Else
sUltimaCelda = "b2"
End If

'seleccionamos el rango de busqueda, para hacer mas rapido el proceso
Range("b2:" & sUltimaCelda).Select

' esto es para localizar la clave que nos interesa... mmm estoy pensando que
' esta parte deberia ser mas corta.
Selection.Find(What:=sDescripcion, After:=ActiveCell, LookIn:=xlValues _
, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate

' una vez localizada la clave, solo hacemos la resta
With Me
ActiveCell.Next.Next.value = Val(ActiveCell.Next.Next.value) - nCantidad
End With

'finalmente, regresamos a la hoja anterior, esto es para evitar errores
ActiveWorkbook.Sheets(hojaActiva).Activate
End Sub
[/CODE]

publicado
Estimados,

Segun el archivo adjunto lo que requiero saber es si es posible que con un textbox se pueda cargar la información (de modo multiline) pero en varias celdas , ya que si ingreso de este modo lo que hace es ir a la misma celda y no una debajo de otra.

Muchas Gracias por su apoyo y tiempo. Saludos

Intenta hacer tus propios formularios ,que si tienes alguna duda te ayudaremos ,pero de mi parte archivos completos no voy a subir ,esfuérzate un poco que lo demás vendrá por añadidura.

Archivado

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

  • 109 ¿Te parecen útiles los tips de las funciones? (ver tema completo)

    1. 1. ¿Te parecen útiles los tips de las funciones?


      • No
      • Ni me he fijado en ellos

  • Ayúdanos a mejorar la comunidad

    • Donaciones recibidas este mes: 0.00 EUR
      Objetivo: 130.00 EUR
  • Archivos

  • Estadísticas de descargas

    • Archivos
      188
    • Comentarios
      98
    • Revisiones
      29

    Más información sobre "Cambios en el Control Horario"
    Última descarga
    Por pegones1

    4    1

  • Crear macros Excel

  • Mensajes

    • Hola, veo que tienes 365, así que esta forma funcionará   Almacen.xlsx
    • Buenos días  @LeandroA espero estes bien Tengo un caso idéntico al planteado en la siguiente pregunta: Sin embargo, a diferencia de quien planteo originalmente la pregunta al correr el código no obtengo ningún resultado podrían ayudarme a resolver este inconveniente y que al hacer click en el Botón Guardar (CommandButton3) del Formulario RCS (frmrcs) el archivo pdf quede configurado con orientación vertical, márgenes superior, inferior, derecho e izquierdo = 1 y en página tamaño carta. Si acaso influye uso Microsoft Excel LTSC MSO (versión 2209 Compilación16.0.1.15629.20200) de 64 bits Mucho le sabre agradecer la ayuda que me pueda dar  RCS PRUEBA - copia.xlsm
    • @JSDJSDCon gusto mi estimado Para la opción 1: Sub Surtirhastadondealcanse() Dim ws As Worksheet Set ws = ThisWorkbook.Sheets(1) Dim filaInicio As Integer: filaInicio = 4 Dim filaFin As Integer: filaFin = 7 Dim colInventario As Integer: colInventario = 2 Dim colSolicitudesInicio As Integer: colSolicitudesInicio = 4 ' Columna C Dim colResultadoInicio As Integer: colResultadoInicio = 9 ' Columna I Dim colTotalSurtido As Integer: colTotalSurtido = 12 ' Columna L Dim colFinalInventario As Integer: colFinalInventario = 13 ' Columna M Dim numClientes As Integer: numClientes = 3 Dim fila As Integer, i As Integer For fila = filaInicio To filaFin Dim inventario As Double inventario = Val(ws.Cells(fila, colInventario).Value) Dim solicitudes(1 To 3) As Double Dim surtido(1 To 3) As Variant Dim totalSurtido As Double: totalSurtido = 0 ' Leer solicitudes For i = 1 To numClientes If IsNumeric(ws.Cells(fila, colSolicitudesInicio + i - 1).Value) Then solicitudes(i) = CDbl(ws.Cells(fila, colSolicitudesInicio + i - 1).Value) Else solicitudes(i) = 0 End If surtido(i) = "POR FALTA STOCK" Next i ' Surtir de acuerdo al inventario disponible For i = 1 To numClientes If solicitudes(i) > 0 Then If inventario >= solicitudes(i) Then surtido(i) = solicitudes(i) inventario = inventario - solicitudes(i) totalSurtido = totalSurtido + solicitudes(i) ElseIf inventario > 0 Then surtido(i) = inventario totalSurtido = totalSurtido + inventario inventario = 0 Else surtido(i) = "POR FALTA STOCK" End If End If Next i ' Escribir resultados en las columnas correspondientes para cada cliente For i = 1 To numClientes With ws.Cells(fila, colResultadoInicio + i - 1) If surtido(i) = "POR FALTA STOCK" Then .Value = surtido(i) .Font.Color = vbRed Else .Value = surtido(i) .Font.Color = vbBlack End If End With Next i ' Escribir total surtido y existencia final ws.Cells(fila, colTotalSurtido).Value = totalSurtido ws.Cells(fila, colFinalInventario).Value = inventario Next fila MsgBox "Resultado surtido cargado con éxito...", vbInformation End Sub Para la opción 2:   Sub surtirenpartesiguales() Dim ws As Worksheet Set ws = ThisWorkbook.Sheets(1) Dim filaInicio As Integer: filaInicio = 13 Dim filaFin As Integer: filaFin = 16 Dim colInventario As Integer: colInventario = 2 Dim colSolicitudesInicio As Integer: colSolicitudesInicio = 4 ' Columna C Dim colResultadoInicio As Integer: colResultadoInicio = 9 ' Columna I Dim colTotalSurtido As Integer: colTotalSurtido = 12 ' Columna L Dim colFinalInventario As Integer: colFinalInventario = 13 ' Columna M Dim numClientes As Integer: numClientes = 3 Dim fila As Integer, i As Integer For fila = filaInicio To filaFin Dim inventario As Double inventario = Val(ws.Cells(fila, colInventario).Value) Dim solicitudes(1 To 3) As Double Dim surtido(1 To 3) As Variant Dim totalSurtido As Double: totalSurtido = 0 Dim totalPedido As Double: totalPedido = 0 ' Leer solicitudes For i = 1 To numClientes If IsNumeric(ws.Cells(fila, colSolicitudesInicio + i - 1).Value) Then solicitudes(i) = CDbl(ws.Cells(fila, colSolicitudesInicio + i - 1).Value) totalPedido = totalPedido + solicitudes(i) Else solicitudes(i) = 0 End If surtido(i) = 0 Next i ' Si hay suficiente inventario, surtir lo que el cliente pide If inventario >= totalPedido Then For i = 1 To numClientes If solicitudes(i) > 0 And inventario >= solicitudes(i) Then surtido(i) = solicitudes(i) inventario = inventario - solicitudes(i) totalSurtido = totalSurtido + solicitudes(i) End If Next i Else ' Reparto base igualitario Dim baseSurtido As Long baseSurtido = Int(inventario / numClientes) For i = 1 To numClientes If solicitudes(i) > 0 Then If solicitudes(i) <= baseSurtido Then surtido(i) = solicitudes(i) inventario = inventario - solicitudes(i) totalSurtido = totalSurtido + solicitudes(i) Else surtido(i) = baseSurtido inventario = inventario - baseSurtido totalSurtido = totalSurtido + baseSurtido End If End If Next i ' Repartir sobrante restante uno por uno, respetando lo pedido Do While inventario > 0 For i = 1 To numClientes If surtido(i) < solicitudes(i) Then surtido(i) = surtido(i) + 1 totalSurtido = totalSurtido + 1 inventario = inventario - 1 If inventario = 0 Then Exit For End If Next i Loop End If ' Escribir resultados en las columnas correspondientes para cada cliente For i = 1 To numClientes With ws.Cells(fila, colResultadoInicio + i - 1) If surtido(i) = 0 Then .Value = "POR FALTA STOCK" .Font.Color = vbRed Else .Value = surtido(i) .Font.Color = vbBlack End If End With Next i ' Escribir total surtido y existencia final ws.Cells(fila, colTotalSurtido).Value = totalSurtido ws.Cells(fila, colFinalInventario).Value = inventario Next fila MsgBox "Resultado surtido cargado con éxito...", vbInformation End Sub Saludos, Diego
    • Buenos dias.  Estoy trabajando en una hoja para poder llevar un control de un pequeño almacén.  Tengo un pedido con varias líneas y "lotes" y necesito sacar las ubicaciones que coincidan con la referencia y lote que pone en el pedido. El problema viene cuando tengo la misma referencia y mismo lote en ubicaciones diferentes y necesito sacar la información en columnas diferentes. No se si  me he explicado bien, pero creo que con el ejemplo adjunto se entiende mejor. Agradecería mucho si me pudieran ayudar  Libro1.xlsx
    • Exelente solución mil gracias 
  • Visualizado recientemente

    • No hay usuarios registrado para ver esta página.
×
×
  • Crear nuevo...

Información importante

Echa un vistazo a nuestra política de cookies para ayudarte a tener una mejor experiencia de navegación. Puedes ajustar aquí la configuración. Pulsa el botón Aceptar, si estás de acuerdo.