Insertar datos hacia abajo

15/12/2008 - 21:37 por Manny_90 | Informe spam
Que tal

Hice un codigo para tomar ciertos datos de una hoja (hoja1) y pegarlos en
otra de manera que inserte los renglones (para no escribir arriba de los
datos que ya existen) en otra hoja (hoja2).

sub pega()
Sheets("hoja2").Select
Range(conjunto).Select
Selection.Copy
Sheets("hoja1").Select
Range(uno1).Offset(1, 0).EntireRow.Select

Selection.Insert shift:=xlDown
Range(ActiveCell, ActiveCell.Offset(0, 12)).Select
Selection.Cut
ActiveCell.Offset(0, 1).Select
ActiveSheet.Paste
end sub

El problema es de cuando llega a la linea "Selection.Insert shift:=xlDown",
me da un mensaje de error:

ERROR 1004
to prevent possible loss of data, microsoft office excel can not shift
nonblank cells off the worksheet.

Try to locate the last nonblank cell by pressing ctrl+end, and delete or
clear all in the cells betwen the last cell and the end of your data, then
select cell A1 and save your workbook to reset the last cell used.

si algien me puede ayudar a saber que puedo hacer o modificar el macro...


muchas gracias.

Preguntas similare

Leer las respuestas

#1 Héctor Miguel
15/12/2008 - 23:11 | Informe spam
hola, !

Hice un codigo para tomar ciertos datos de una hoja (hoja1) y pegarlos en otra de manera
que inserte los renglones (para no escribir arriba de los datos que ya existen) en otra hoja (hoja2)...
El problema es de cuando llega a la linea "Selection.Insert shift:=xlDown", me da un mensaje de error:
ERROR 1004 to prevent possible loss of data, microsoft office excel can not shift nonblank cells off the worksheet.
Try to locate the last nonblank cell by pressing ctrl+end, and delete or clear all in the cells betwen the last cell and the end of your data
then select cell A1 and save your workbook to reset the last cell used.

si algien me puede ayudar a saber que puedo hacer o modificar el macro...



el mensaje aparece debido a que alguna columna tiene "ocupada" (NO vacia o con formatos/objetos) la "ultima fila" (65536 ?)
y no podria ser desplazada "fuera de la hoja" por efectos de la insercion de filas que intenta hacer el codigo -?-

saludos,
hector.

__ el codigo expuesto __
sub pega()
Sheets("hoja2").Select
Range(conjunto).Select
Selection.Copy
Sheets("hoja1").Select
Range(uno1).Offset(1, 0).EntireRow.Select
Selection.Insert shift:=xlDown
Range(ActiveCell, ActiveCell.Offset(0, 12)).Select
Selection.Cut
ActiveCell.Offset(0, 1).Select
ActiveSheet.Paste
end sub
email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida