Este documento contiene un código en Visual Basic para Aplicaciones (VBA) en Excel que permite automatizar la generación y copia de datos de facturas a una hoja de seguimiento. El código imprime una factura, copia los datos a una hoja de seguimiento, incrementa el número de factura, borra los datos usados, actualiza la fecha y guarda el archivo.
6th floorsharingsession ep 1 - networking - arp v 1.0A Achyar Nur
Protocol that allows dynamic distribution of the information needed to build tables to translate an address A in protocol P’s address space into a 48.bit Ethernet address. (RFC826)
ARP Terminology, How ARP works, and etc
1. Sub Casilladeverificación1_Haga_clic_en()
'Este es un código fácil de implementar en una hoja de excel, para recibir las claves de
modificación y lectura escriba un correo a excelcontablecolombia@gmail.com y registrese
como seguidor. Este aporte no tiene costo, si usted desea contribuir con el mantenimiento de
este blog puede manifestarlo y recibirá las instrucciones, esta donacion lo hará merecedor de
nuevos desarrollos y soporte. Alli va el codigo.
'1. Aqui se imprime la hoja Formato, en la impresora predeterminada
Application.ScreenUpdating = False
Sheets("Form_Impresion").Select
Sheets("Form_Impresion").PrintOut Copies:=1, Collate:=True
'2. Aqui se copian los datos en una hoja de las cuentas de cobro emitidas para control
'Nombre Empresa
Sheets("Form_Impresion").Select
Range("A1").Select
Selection.Copy
Sheets("Listado").Select
Range("A2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False
'Fecha
Sheets("Form_Impresion").Select
Range("B5").Select
Selection.Copy
Sheets("Listado").Select
Range("B2").Select
Do While Not IsEmpty(ActiveCell)
2. ActiveCell.Offset(1, 0).Activate
Loop
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False
'Numero
Sheets("Form_Impresion").Select
Range("E5").Select
Selection.Copy
Sheets("Listado").Select
Range("C2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False
'Nit
Sheets("Form_Impresion").Select
Range("B9").Select
Selection.Copy
Sheets("Listado").Select
Range("D2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False
'Nombre
Sheets("Form_Impresion").Select
Range("B8").Select
3. Selection.Copy
Sheets("Listado").Select
Range("E2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False
'Vr Total
Sheets("Form_Impresion").Select
Range("E28").Select
Selection.Copy
Sheets("Listado").Select
Range("F2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False
'Impuesto
Sheets("Form_Impresion").Select
Range("E31").Select
Selection.Copy
Sheets("Listado").Select
Range("G2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
4. Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False
'Detalle 1
Sheets("Form_Impresion").Select
Range("B21").Select
Selection.Copy
Sheets("Listado").Select
Range("H2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False
'Detalle 2
Sheets("Form_Impresion").Select
Range("B22").Select
Selection.Copy
Sheets("Listado").Select
Range("I2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False
'Detalle 3
Sheets("Form_Impresion").Select
Range("B23").Select
Selection.Copy
Sheets("Listado").Select
5. Range("J2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False
'Detalle 4
Sheets("Form_Impresion").Select
Range("B24").Select
Selection.Copy
Sheets("Listado").Select
Range("K2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False
'Detalle 5
Sheets("Form_Impresion").Select
Range("B25").Select
Selection.Copy
Sheets("Listado").Select
Range("L2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False
'Detalle 6
6. Sheets("Form_Impresion").Select
Range("B26").Select
Selection.Copy
Sheets("Listado").Select
Range("M2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False
'Detalle 7
Sheets("Form_Impresion").Select
Range("B27").Select
Selection.Copy
Sheets("Listado").Select
Range("N2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False
'3. Aqui se vuelve a la hoja Formato Captura,se desprotege la hoja, se aumenta en 1 el numero
de Cuenta de cobro, y se vuelve a proteger
Sheets("FormatoCaptura").Unprotect "*****"
Sheets("FormatoCaptura").Select
'Consecutivo
If Range("B1") = "123456789" Then
Range("F4").Value = Range("F4").Value + 1
Else
7. Range("B1") = "123456789"
End If
ActiveSheet.Protect "*****", DrawingObjects:=True, Contents:=True, Scenarios:=True
'4. Aqui se borran los datos ya usados
Sheets("FormatoCaptura").Select
Range("B1").Select
ActiveCell.FormulaR1C1 = " "
Range("B2").Select
ActiveCell.FormulaR1C1 = " "
Range("D2").Select
ActiveCell.FormulaR1C1 = " "
Range("A4:D4").Select
Selection.ClearContents
Range("A5:D5").Select
Selection.ClearContents
Range("A6:D6").Select
Selection.ClearContents
Range("A7:D7").Select
Selection.ClearContents
Range("A8:D8").Select
Selection.ClearContents
Range("A9:D9").Select
Selection.ClearContents
Range("A10:D10").Select
Selection.ClearContents
Range("B1").Select
'5. Por defecto la fecha actual, si se requiere puede cambiarla
8. Range("D2").Select
ActiveCell.FormulaR1C1 = "=+NOW()"
Range("B1").Select
ActiveCell.FormulaR1C1 = "123456789"
Range("E2").Select
ActiveCell.FormulaR1C1 = "<<Actualice Fecha..."
'6. Por defecto Reteiva del 8%, puede modificarse manualmente
Range("F6").Select
ActiveCell.FormulaR1C1 = "0.08"
Range("D2").Select
'7. Se guarda el archivo
ActiveWorkbook.Save
'FIN....
Application.ScreenUpdating = True
End Sub