Copiando Dtos entre Hojas con CheckPoint

08/10/2003 - 02:21 por gabrielt | Informe spam
Hola que tal
Tengo 3 Hojas en un solo archivo de Excel una es de Concentrado de
Ventas, otra es de Cuentas por Cobrar y otra de Reporte Semanal
Mi problema es que hice una forma que tiene los siguentes campos
COMPAÑIA,
CANTIDAD, FECHA FACTURA, RESPONSABLE, # DE FACTURA, VENTA, MODO DE
PAGO, FECHA DE PAGO y 2 CheckPointŽs uno es para Pagos y el otro es
para los que tiene deudas
Lo que yo quisiera saber como es la forma de cuando se escoja el
CheckPoint de Pago Copie de la Forma los Campos COMPANIA, CANTIDAD,
FECHA, RESPONSABLE, VENTA en la Hoja de Reporte Semanal y cada vez que
se agregue todos estos campos se inserte un nuevo renglon
Y cuando se escoja el CheckPoint se copie Los campos COMPAÑIA,
CANTIDAD, FECHA FACTURA, RESPONSABLE, # DE FACTURA, VENTA en la Hoja
Cuentas Por Cobrar y al mismo tiempo se copie en la Hoja de Reporte
Semanal y cada vez ke se garegen estos campos se inserte un nuevo
renglon
Yo lo he estado intentandolo pero se me me agrega en la hoja de Ventas
y no se agregan en las demas que yo le pido. Si pe podria alguien
ayudar ya ke soy novato Macros de Excel en Visual Basic

Aqui esta el codigo ke estoy manejando

Private Sub UserForm_Activate()
ActiveSheet.Range("a3").Activate
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
End Sub

Private Sub CheckBox1_Change()
Sheets("Concentrado Ventas Jun 03-04").Range("a3").Copy
Destination:=Sheets("Reporte Semanal").Range("a5")
With Selection.Font
.Color = 52
End With
With ActiveCell

.Offset(0, 0).Value = TxtCompañia
.Offset(0, 1).Value = TxtCantidad
.Offset(0, 2).Value = TxtFechaFactura
.Offset(0, 3).Value = TxtResponsable
.Offset(0, 4).Value = TxtVenta
ActiveCell.Offset(1, 0).Activate
End With
End Sub


Private Sub CheckBox2_Change()
Sheets("Concentrado Ventas Jun 03-04").Copy
Destination:=Sheets("Reporte Semanal").Range("a5")

With Selection.Font
.Color = 3
End With
With ActiveCell

.Offset(0, 0).Value = TxtCompañia
.Offset(0, 1).Value = TxtCantidad
.Offset(0, 2).Value = TxtFechaFactura
.Offset(0, 3).Value = TxtResponsable
.Offset(0, 4).Value = TxtVenta
ActiveCell.Offset(1, 0).Activate

End With

Sheets("Concentrado Ventas Jun 03-04").Range("a3").Copy
Destination:=Sheets("Cuentas por Cobrar").Range("a5")

With Selection.Font
.Color = 3
End With
With ActiveCell
.Value = TxtCompañia
.Offset(0, 0).Value = TxtCompañia
.Offset(0, 1).Value = TxtCantidad
.Offset(0, 2).Value = TxtFechaFactura
.Offset(0, 3).Value = TxtResponsable
.Offset(0, 4).Value = TxtNoFactura
.Offset(0, 5).Value = TxtVenta
ActiveCell.Offset(1, 0).Activate

End With
End Sub


Private Sub cmdAceptar_Click()
ValidarCampos
Selection.EntireRow.Insert
End Sub
Private Sub cmdTerminar_Click()
Unload FrmTomarDatos
End Sub
Private Sub TxtCantidad_Change()
If Len(TxtCantidad.Text) = 6 Then
TxtFechaFactura.SetFocus
End If
End Sub
Private Sub TxtNoFactura_Change()
If Len(TxtNoFactura.Text) = 5 Then
TxtVenta.SetFocus
End If
End Sub

Private Sub ValidarCampos()
Dim Error As String
Dim ValorMensaje As Integer
Error = "Error en los datos del formulario"
If Len(TxtCompañia) = 0 Then
ValorMensaje = MsgBox("El campo Compañia esta vacio",
vbOKOnly, Error)
TxtCompañia.SetFocus
Else
If Len(TxtNoFactura) = 0 Then
ValorMensaje = MsgBox("El campo Numero de Factura esta
vacio", vbOKOnly, Error)
TxtCompañia.SetFocus
Else
If Len(CheckBox1) = 0 Then
ValorMensaje = MsgBox("No ha especificado la Forma
de pago", vbOKOnly, Error)
Else

With ActiveCell
.Value = TxtCompañia
.Offset(0, 0).Value = TxtCompañia
.Offset(0, 1).Value = TxtCantidad
.Offset(0, 2).Value = TxtFechaFactura
.Offset(0, 3).Value = TxtResponsable
.Offset(0, 4).Value = TxtNoFactura
.Offset(0, 5).Value = TxtVenta
.Offset(0, 6).Value = TxtModoPago
.Offset(0, 7).Value = TxtFechaPago
ActiveCell.Offset(1, 0).Activate
BorrarFormulario

End With
End If
End If
End If
End Sub
Private Sub BorrarFormulario()
TxtCompañia.Text = ""
TxtCantidad.Text = ""
TxtFechaFactura.Text = ""
TxtResponsable.Text = ""
TxtNoFactura.Text = ""
TxtVenta.Text = ""
TxtModoPago.Text = ""
TxtFechaPago.Text = ""

End Sub
 

Leer las respuestas

#1 gti
11/10/2003 - 19:08 | Informe spam
¿has probado a generar el codigo con la grabadora de macros para ambos casos
y después adaptarlo a los chckbox?



"Delta" escribió en el mensaje
news:
Hola que tal
Tengo 3 Hojas en un solo archivo de Excel una es de Concentrado de
Ventas, otra es de Cuentas por Cobrar y otra de Reporte Semanal
Mi problema es que hice una forma que tiene los siguentes campos
COMPAÑIA,
CANTIDAD, FECHA FACTURA, RESPONSABLE, # DE FACTURA, VENTA, MODO DE
PAGO, FECHA DE PAGO y 2 CheckPoint´s uno es para Pagos y el otro es
para los que tiene deudas
Lo que yo quisiera saber como es la forma de cuando se escoja el
CheckPoint de Pago Copie de la Forma los Campos COMPANIA, CANTIDAD,
FECHA, RESPONSABLE, VENTA en la Hoja de Reporte Semanal y cada vez que
se agregue todos estos campos se inserte un nuevo renglon
Y cuando se escoja el CheckPoint se copie Los campos COMPAÑIA,
CANTIDAD, FECHA FACTURA, RESPONSABLE, # DE FACTURA, VENTA en la Hoja
Cuentas Por Cobrar y al mismo tiempo se copie en la Hoja de Reporte
Semanal y cada vez ke se garegen estos campos se inserte un nuevo
renglon
Yo lo he estado intentandolo pero se me me agrega en la hoja de Ventas
y no se agregan en las demas que yo le pido. Si pe podria alguien
ayudar ya ke soy novato Macros de Excel en Visual Basic

Aqui esta el codigo ke estoy manejando

Private Sub UserForm_Activate()
ActiveSheet.Range("a3").Activate
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
End Sub

Private Sub CheckBox1_Change()
Sheets("Concentrado Ventas Jun 03-04").Range("a3").Copy
Destination:=Sheets("Reporte Semanal").Range("a5")
With Selection.Font
.Color = 52
End With
With ActiveCell

.Offset(0, 0).Value = TxtCompañia
.Offset(0, 1).Value = TxtCantidad
.Offset(0, 2).Value = TxtFechaFactura
.Offset(0, 3).Value = TxtResponsable
.Offset(0, 4).Value = TxtVenta
ActiveCell.Offset(1, 0).Activate
End With
End Sub


Private Sub CheckBox2_Change()
Sheets("Concentrado Ventas Jun 03-04").Copy
Destination:=Sheets("Reporte Semanal").Range("a5")

With Selection.Font
.Color = 3
End With
With ActiveCell

.Offset(0, 0).Value = TxtCompañia
.Offset(0, 1).Value = TxtCantidad
.Offset(0, 2).Value = TxtFechaFactura
.Offset(0, 3).Value = TxtResponsable
.Offset(0, 4).Value = TxtVenta
ActiveCell.Offset(1, 0).Activate

End With

Sheets("Concentrado Ventas Jun 03-04").Range("a3").Copy
Destination:=Sheets("Cuentas por Cobrar").Range("a5")

With Selection.Font
.Color = 3
End With
With ActiveCell
.Value = TxtCompañia
.Offset(0, 0).Value = TxtCompañia
.Offset(0, 1).Value = TxtCantidad
.Offset(0, 2).Value = TxtFechaFactura
.Offset(0, 3).Value = TxtResponsable
.Offset(0, 4).Value = TxtNoFactura
.Offset(0, 5).Value = TxtVenta
ActiveCell.Offset(1, 0).Activate

End With
End Sub


Private Sub cmdAceptar_Click()
ValidarCampos
Selection.EntireRow.Insert
End Sub
Private Sub cmdTerminar_Click()
Unload FrmTomarDatos
End Sub
Private Sub TxtCantidad_Change()
If Len(TxtCantidad.Text) = 6 Then
TxtFechaFactura.SetFocus
End If
End Sub
Private Sub TxtNoFactura_Change()
If Len(TxtNoFactura.Text) = 5 Then
TxtVenta.SetFocus
End If
End Sub

Private Sub ValidarCampos()
Dim Error As String
Dim ValorMensaje As Integer
Error = "Error en los datos del formulario"
If Len(TxtCompañia) = 0 Then
ValorMensaje = MsgBox("El campo Compañia esta vacio",
vbOKOnly, Error)
TxtCompañia.SetFocus
Else
If Len(TxtNoFactura) = 0 Then
ValorMensaje = MsgBox("El campo Numero de Factura esta
vacio", vbOKOnly, Error)
TxtCompañia.SetFocus
Else
If Len(CheckBox1) = 0 Then
ValorMensaje = MsgBox("No ha especificado la Forma
de pago", vbOKOnly, Error)
Else

With ActiveCell
.Value = TxtCompañia
.Offset(0, 0).Value = TxtCompañia
.Offset(0, 1).Value = TxtCantidad
.Offset(0, 2).Value = TxtFechaFactura
.Offset(0, 3).Value = TxtResponsable
.Offset(0, 4).Value = TxtNoFactura
.Offset(0, 5).Value = TxtVenta
.Offset(0, 6).Value = TxtModoPago
.Offset(0, 7).Value = TxtFechaPago
ActiveCell.Offset(1, 0).Activate
BorrarFormulario

End With
End If
End If
End If
End Sub
Private Sub BorrarFormulario()
TxtCompañia.Text = ""
TxtCantidad.Text = ""
TxtFechaFactura.Text = ""
TxtResponsable.Text = ""
TxtNoFactura.Text = ""
TxtVenta.Text = ""
TxtModoPago.Text = ""
TxtFechaPago.Text = ""

End Sub

Preguntas similares