Visual Basic - Copiar folio a otra hoja

Life is soft - evento anual de software empresarial
 
Vista:
sin imagen de perfil
Val: 13
Ha disminuido su posición en 4 puestos en Visual Basic (en relación al último mes)
Gráfica de Visual Basic

Copiar folio a otra hoja

Publicado por Cristhian (6 intervenciones) el 05/06/2020 20:40:01
Hola buenas tardes, estoy empezando a conocer visual basic y no me manejo muy bien.
Espero puedan echarme una mano con algo que necesito.
Estoy intentando crear un pequeño código que me permita exportar desde Excel, a un archivo nuevo, grabarlo con un folio, nombre y un numero de factura especifico, ademas de ajustar y poner titulo. Todo eso lo tengo listo, mi problema esta en que necesito que el folio que estoy utilizando se vaya grabando automáticamente después de exportar el archivo. Me explico: Tengo un libro en donde guardare los folios, ahora necesito que cuando se exporte el nuevo archivo el folio que contiene que va incluido en este se grabe en el libro FOLIOS, pero no se como hacerlo.
espero me puedan ayudar.
les dejo el código que hice (ademas adjunte una imagen del formato del archivo que estoy exportando):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
Sub EXPORTAR_FACT_1_MONTO()
'
' EXPORTAR_FACT_1_MONTO Macro
'
Dim Hoy As Date
Hoy = DateTime.Now
 
Dim Carpeta As String
Carpeta = MonthName(Month(Hoy))
 
Dim nombre As String
nombre = Range("E59").Value
 
Dim Folio As String
Folio = Range("E64").Value
 
Dim FECHA As Date
 
 
    Range("Tabla1[[#Headers],[SERIE]]").Select
    Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
    Selection.Copy
    Workbooks.Add
    ActiveSheet.Paste
    Application.CutCopyMode = False
    ActiveSheet.ListObjects("Tabla1").ShowAutoFilterDropDown = False
    ActiveWindow.DisplayZeros = False
    Application.Run "PERSONAL.XLSB!FIJA_TITULOS"
    Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
    Range("Tabla1").Select
    Selection.Copy
    Range("A2").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    ActiveWindow.ScrollRow = 6
    ActiveWindow.ScrollRow = 7
    ActiveWindow.ScrollRow = 8
    ActiveWindow.ScrollRow = 9
    ActiveWindow.ScrollRow = 10
    ActiveWindow.ScrollRow = 11
    ActiveWindow.ScrollRow = 12
    ActiveWindow.ScrollRow = 13
    ActiveWindow.ScrollRow = 14
    ActiveWindow.ScrollRow = 16
    ActiveWindow.ScrollRow = 17
    ActiveWindow.ScrollRow = 18
    ActiveWindow.ScrollRow = 19
    ActiveWindow.ScrollRow = 20
    ActiveWindow.ScrollRow = 21
    ActiveWindow.ScrollRow = 22
    ActiveWindow.ScrollRow = 23
    ActiveWindow.ScrollRow = 24
    ActiveWindow.ScrollRow = 25
    Range("D57").Select
    ActiveSheet.ListObjects("Tabla3").ShowAutoFilterDropDown = False
    Range("A54:D54").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    Range("J54").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    Range("Tabla3").Select
    Selection.Copy
    Range("D57").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    ActiveWindow.ScrollRow = 26
    ActiveWindow.ScrollRow = 27
    ActiveWindow.ScrollRow = 28
    Range("E64").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    Range("A2").Select
 
    ChDir "C:\Facturacion"
    ActiveWorkbook.SaveAs Filename:="C:\Facturacion\" & Carpeta & "\Convenio\" & Folio & " - Detalle_Factura_"
    & nombre & ".xlsx", FileFormat:= _
        xlOpenXMLWorkbook, CreateBackup:=False
 
    'SEGUNDA PARTE
 
    Application.Run "PERSONAL.XLSB!FIJA_TITULOS"
 
    ActiveWindow.DisplayZeros = False
    ActiveSheet.PageSetup.LeftHeaderPicture.Filename = _
       "C:\Mis Documentos\Imagenes\Atlanta\prueba2.jpg"
 
    With ActiveSheet.PageSetup.LeftHeaderPicture
        .Height = 45.75
        .Width = 48
    End With
    Application.PrintCommunication = False
    With ActiveSheet.PageSetup
        .PrintTitleRows = ""
        .PrintTitleColumns = ""
    End With
    Application.PrintCommunication = True
    ActiveSheet.PageSetup.PrintArea = ""
    Application.PrintCommunication = False
    With ActiveSheet.PageSetup
        .LeftHeader = "&G"
        .CenterHeader = _
        "&""Tahoma,Negrita""&14IMPORTADORA Y EXPORTADORA" & Chr(10) & _
        "NUEVA ATLANTA LTDA." & Chr(10) & "RUT: 78.050.590-7&""Tahoma,Normal""&10" & _
        Chr(10) & "" & Chr(10) & "" & Chr(10) & "&""Tahoma,Negrita""&12MAYO DE 2020"
        .RightHeader = ""
        .LeftFooter = ""
        .CenterFooter = ""
        .RightFooter = ""
        .LeftMargin = Application.InchesToPoints(0.31496062992126)
        .RightMargin = Application.InchesToPoints(0.118110236220472)
 
        '.TopMargin = Application.InchesToPoints(0.866141732283465)
        .TopMargin = Application.InchesToPoints(1.73228346456693)
 
        .BottomMargin = Application.InchesToPoints(0.15748031496063)
        .HeaderMargin = Application.InchesToPoints(0.31496062992126)
        .FooterMargin = Application.InchesToPoints(0.31496062992126)
        .PrintHeadings = False
        .PrintGridlines = False
        .PrintComments = xlPrintNoComments
        .PrintQuality = 600
        .CenterHorizontally = False
        .CenterVertically = False
        .Orientation = xlPortrait
        .Draft = False
        .PaperSize = xlPaperLetter
        .FirstPageNumber = xlAutomatic
        .Order = xlDownThenOver
        .BlackAndWhite = False
        .Zoom = 70
        .PrintErrors = xlPrintErrorsDisplayed
        .OddAndEvenPagesHeaderFooter = False
        .DifferentFirstPageHeaderFooter = False
        .ScaleWithDocHeaderFooter = True
        .AlignMarginsHeaderFooter = True
        .EvenPage.LeftHeader.Text = ""
        .EvenPage.CenterHeader.Text = ""
        .EvenPage.RightHeader.Text = ""
        .EvenPage.LeftFooter.Text = ""
        .EvenPage.CenterFooter.Text = ""
        .EvenPage.RightFooter.Text = ""
        .FirstPage.LeftHeader.Text = ""
        .FirstPage.CenterHeader.Text = ""
        .FirstPage.RightHeader.Text = ""
        .FirstPage.LeftFooter.Text = ""
        .FirstPage.CenterFooter.Text = ""
        .FirstPage.RightFooter.Text = ""
    End With
End Sub




De ante mano muchas gracias para las personas que puedan ayudarme.

Atte.
Cristhian
Inkedfact_LI
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil
Val: 13
Ha disminuido su posición en 4 puestos en Visual Basic (en relación al último mes)
Gráfica de Visual Basic

Copiar folio a otra hoja

Publicado por Cristhian (6 intervenciones) el 21/07/2020 18:52:35
Alguien que me ayude con esto por fa ...!!!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar