Saltar al contenido

Error en la macro,


faty23

Recommended Posts

publicado

Hola

He creado el siguiente código para introducir datos en excel. De manera que el código detecte cual es la última fila escrita, se sitúe en la siguiente y vaya pidiendo la información y la vaya colocando en la celda correspondiente de la columna.

Private Sub CommandButton2_Click()

Dim Nombre As String

Dim tipología As String

Dim CSAP As String

Dim CANTG As String

Dim Sistema_Operativo As String

Dim Características_Tecnológicas As String

Dim Fecha_Inclusión_Catálogo As Date

Dim Terminal_sin_Alta As Integer

Dim SPGE As Integer

Dim Apoyo_Canje As Integer

Dim Pantalla As Integer

Dim Duración_Batería As String

Dim Dimensiones As Integer

Dim Peso As Integer

Dim Fila As String

Dim Columna As String

Dim jj

Dim nn

Nombre = Val(InputBox("Introduzca_el_nombre_del_nuevo_modelo(return para terminal):", "Nombre"))

tipología = Val(InputBox("Introduzca_la_tipología_del_nuevo_modelo", "Entrar"))

CSAP = Val(InputBox("Introduzca_CSAP", "Entrar"))

CANTG = Val(InputBox("Introduzca_CANTG", "Entrar"))

Sistema_Operativo = Val(InputBox("Introduzca el Sistema_Operativo", "Entrar"))

Características_Tecnológicas = Val(InputBox("Introduzca_las_características", "Entrar"))

Fecha_Inclusión_Catálogo = CDate(InputBox("Introduzca_Fecha_Inclusión", "Entrar"))

Terminal_sin_Alta = Val(InputBox("Introduzca_Terminal_sin_alta", "Entrar"))

Terminal_con_Alta = Val(InputBox("Introduzca_Terminal_con_Alta", "Entrar"))

SPGE = Val(InputBox("Introduzca_SPGE", "Entrar"))

Apoyo_Canje = Val(InputBox("introduzca_El_Apoyo_de_Canje", "Entrar"))

Pantalla = Val(InputBox("Introduzca_el_Tamaño_Pantalla", "Entrar"))

Duración_Batería = Val(InputBox("Introduzca_la_duración_de_la_Batería", "Entrar"))

Dimensiones = Val(InputBox("Introduzca_las_dimensiones_del_terminal", "Entrar"))

Peso = Val(InputBox("Introduzca el peso", "Entrar"))

With ActiveCell

.Value = Nombre

.Offset(0, 4).Value = tipología

.Offset(0, 5).Value = CSAP

.Offset(0, 6).Value = CANTG

.Offset(0, 7).Value = Sistema_Operativo

.Offset(0, 8).Value = Características_Tecnológicas

.Offset(0, 9).Value = Fecha_Inclusión_Catálogo

.Offset(0, 10).Value = Terminal_sin_Alta

.Offset(0, 11).Value = Terminal_con_Alta

.Offset(0, 12).Value = SPGE

.Offset(0, 13).Value = Apoyo_Canje

.Offset(0, 14).Value = Pantalla

.Offset(0, 15).Value = Duración_Batería

.Offset(0, 16).Value = Dimensiones

.Offset(0, 17).Value = Peso

End With

ActiveCell.Offset(1, 0).Activate

"MsgBox("Deseas_continuar",vbYesNo + vbQuestion, "opci" ///no sabría como ponerlo///

End Sub

¿Qué es lo que falla? ¿que no me copia en la celda correspondiente? No tengo mucho conocimiento de excel y es un curro, yo creo que me falta código

Gracias

Un saludo

publicado

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

TE lo puedo mandar por msj o algo. Es que ocupa mucho y le he quitado bastante cosas pero sigue siendo grande.

Soy nueva en el foro, perdonad por estar tan verde

Lo he comprimido y se sige pasando.

publicado

Yo uso esto para guardar mis datos de un formulario a una base de datos lineal.

Aplico uno por cada celda a copiar en este caso el codigo qt muestro tiene todas las celdas de mi formulario.

Sub GUARDAR1()
'
' GUARDAR1 Macro
' Macro grabada el 16/03/2010 por ULISES GONZALES
' Macro grabada el 21/03/2011 por ULISES GONZALES
'
Dim oProgress As New frm_lcf_ProgressBar
Dim style As Integer
Dim windowCaption As String
Dim endRow As Long
Dim i As Long
style = 2
windowCaption = "SE ESTAN GUARDANDO LOS REGISTROS"
endRow = 50000
oProgress.Initialize endRow, style, windowCaption
oProgress.Show 0
For i = 0 To endRow - 4
oProgress.Increase
Next
oProgress.Increase 4
Unload oProgress

Application.ScreenUpdating = False
Sheets("ESTADISTICA DE TRANSCRIPCION").Select
Range("D6").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("D4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("D" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("B6").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("E4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("E" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("I15").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("F4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("F" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("B14").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("G4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("G" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("E14").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("H4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("H" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("I14").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("I4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("I" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("E15").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("J4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("J" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("F6").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("K4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("K" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("H6").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("L4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("L" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("J6").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("M4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("M" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("B8").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("N4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("N" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("D8").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("O4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("O" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("H8").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("P4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("P" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("E21").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("Z4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("Z" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With


Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("G21").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AA4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AA" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("E22").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AB4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AB" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("G22").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AC4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AC" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("K23").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AD4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AD" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("F23").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AE4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AE" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("G24").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AF4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AF" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("B12").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AG4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AG" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("E12").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AH4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AH" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("G12").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AI4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AI" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("I12").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AJ4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AJ" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("B17").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AK4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AK" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("B19").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AL4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AL" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("J6").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AM4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AM" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("B6").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AN4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AN" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Application.ScreenUpdating = Trae

End Sub[/code]

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

Yo uso esto para guardar mis datos de un formulario a una base de datos lineal.

Aplico uno por cada celda a copiar en este caso el codigo qt muestro tiene todas las celdas de mi formulario.

Sub GUARDAR1()
'
' GUARDAR1 Macro
' Macro grabada el 16/03/2010 por ULISES GONZALES
' Macro grabada el 21/03/2011 por ULISES GONZALES
'
Dim oProgress As New frm_lcf_ProgressBar
Dim style As Integer
Dim windowCaption As String
Dim endRow As Long
Dim i As Long
style = 2
windowCaption = "SE ESTAN GUARDANDO LOS REGISTROS"
endRow = 50000
oProgress.Initialize endRow, style, windowCaption
oProgress.Show 0
For i = 0 To endRow - 4
oProgress.Increase
Next
oProgress.Increase 4
Unload oProgress

Application.ScreenUpdating = False
Sheets("ESTADISTICA DE TRANSCRIPCION").Select
Range("D6").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("D4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("D" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("B6").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("E4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("E" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("I15").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("F4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("F" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("B14").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("G4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("G" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("E14").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("H4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("H" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("I14").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("I4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("I" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("E15").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("J4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("J" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("F6").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("K4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("K" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("H6").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("L4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("L" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("J6").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("M4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("M" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("B8").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("N4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("N" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("D8").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("O4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("O" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("H8").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("P4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("P" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("E21").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("Z4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("Z" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With


Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("G21").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AA4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AA" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("E22").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AB4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AB" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("G22").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AC4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AC" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("K23").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AD4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AD" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("F23").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AE4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AE" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("G24").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AF4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AF" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("B12").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AG4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AG" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("E12").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AH4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AH" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("G12").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AI4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AI" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("I12").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AJ4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AJ" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("B17").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AK4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AK" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("B19").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AL4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AL" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("J6").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AM4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AM" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Windows("SISTEMA 0800BOMBONA 4.1 Año-2011.xls").Activate
Range("B6").Select
Selection.Copy
Windows("STADISTICAS 0800Bombona Nº1.xls").Activate
Sheets("ESTADISTICAS DIARIAS").Select
Range("AN4").Select
ActiveCell.End(xlDown).Select
ultima = ActiveCell.Row + 1
Range("AN" & ultima).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

Application.ScreenUpdating = Trae

End Sub[/CODE]

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.