Copiar celdas a hoja2

Que tal, espero no molestarte con mi problemita, tengo varios días dándole vuelta.
Mira en la "hoja1" tengo resultados de fórmulas de la celda C16 a R16, los cuales quiero copiar por medio de una macro a la "hoja2" pero empezando en la celda C17 a R17, y que ya copiadas me regrese a la celda C16 de la "hoja1" y al ejecutar de nuevo la macro me los copie, pero ahora en la celda C19 a R 19 de la "hoja2" y así sucesivamente. Espero me puedas ayudar. DE antemano Gracias

1 respuesta

Respuesta
1
No te preocupes no hay problema, ¿pero una consulta dime y necesariamente se tiene que volver a ejecutar la macro para que se copie en C19 a R19 porque no de frente copiar en C17 a R17 y C19 a R19? ¿Ahh y hasta cuando se tiene que hacer esas repeticiones? ¿O solo se debe copiar en C17 a R17 y en C19 a R19 y se acabo? ¿O continua? ¿Y siempre el salto va a ser de 2 en 2?
Gracias por tu pronta respuesta, mira cómo los resultados de las fórmulas me salen solamente en C16 a R16, lo que necesito es que por medio de un botón de comando, se copien en C17 a R17 en la "hoja2", y regrese a C16 a r16, y yo haga manualmente cambios en los resultados y al apretar nuevamente el botón de comando se copien C19 a R19, as´hasta C40 a R40 y en cualquier momento yo borrar lo que se grabó en la "hoja2" lo que se haya grabado de C17:C40 a R17:R40 estos ´son los rangos donde quiero que se grabe, espero si me haya explicado. Agradeciéndote de antemano tu ayuda.
Ok dejame ver la manera de hacerlo, pero dime y que pasa con C18:¿R18? Porque necesariamente te tienes que saltear a C19:¿R19?
Por problemas de formato, en c18 A R18 vienen las explicaciones de los resultados de C17 a R17, y así sucesivamente
OK, ¿entonces siempre se va a saltear una fila?, espera un momento más y te tengo listo el código.
El código ya casi esta el detalle es que aun no logro hacer que haga el salto es decir que salte una linea, ¿dime algo lo que escribirás en esa linea vacía osea en C18 R18 que cosa es? ¿Esos valores que pongas ahí Van a Cambiar? ¿La macro no puede correr si es que dejo alguna espacio en blanco entre fila y fila?
Pega esta fórmula en un modulo, ojo que tus hojas tienen que llamarse hoja1 y hoja2 eh
Sub formula()
Sheets("Hoja1").Select
ActiveSheet.Range("C16").Select
i = 0
Do While ActiveCell <> Empty
ActiveCell.Offset(1, 0).Select
i = i + 1
Loop
d = 16
Sheets("Hoja2").Select
ActiveSheet.Range("C17").Select
ActiveCell.formula = "=Hoja1!C" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!D" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!E" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!F" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!G" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!H" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!I" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!J" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!K" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!L" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!M" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!N" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!O" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!P" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!Q" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!R" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
'ActiveSheet.Range("C19").Select
'ActiveCell.FormulaR1C1 = "d"
Sheets("Hoja2").Select
ActiveSheet.Range("C17").Select
Do While ActiveCell <> Empty
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.FormulaR1C1 = "d"
For x = 1 To i
ActiveCell.formula = "=Hoja1!C" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!D" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!E" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!F" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!G" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!H" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!I" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!J" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!K" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!L" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!M" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!N" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!O" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!P" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!Q" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
ActiveCell.formula = "=Hoja1!R" & Format(d) & ""
ActiveCell.Offset(0, 1).Select
d = d + 1
Next
ActiveSheet.Range("C17").Select
Do While ActiveCell <> Empty
ActiveCell.Offset(2, 0).Select
Loop
ActiveCell.formula = " "
Range("C17:R17").Select
Selection.ClearContents
Range("C18:R100").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Hoja1").Select
ActiveSheet.Range("C16").Select
End Sub
Espero te sirva, saludos y no olvides cerrar la pregunta.
Que tal, oye me aparece este error: "se ha producido el error '1004' en tiempo de ejecución, error en el método Select de la clase Range.
Espero tú respuesta
¿Me puedes mandar tu archivo para solucionar en definitiva?, mi correo es [email protected]
Que tal, oye si esta bien el correo que me diste, porque me lo regresa, ya lo zipe, pero aun así me regresa el correo
Que raro seguro pesa mucho trata de hacerlo más livitano que no pese tanto mandame solo la información importante por ejemplo si son mil mandame solo 500 los necesarios con los que pueda probar la macro.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas