![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Buscar | Temas de Hoy | Marcar Foros Como Leídos |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
#2
|
|||
|
|||
|
Copiar y pegar
Hola, te paso dos procedimientos que hacen lo que necesitas, si bien no estan hechas para que trabajen sobre la planilla de excel, puedes adaptar el codigo facilmente para que lo haga(estan hechas sobre un stringgrid). Yo utilizo un stringgrid auxiliar, pero mas que nada lo puse para poder verificar los datos.
procedure TForm1.CopiarCortarSel(borrar:bool); var i,j:integer; RecCopiar:TGridRect; begin RecCopiar:=stringgrid1.Selection; stringgrid2.ColCount:=RecCopiar.Right-RecCopiar.Left+2; stringgrid2.rowCount:=RecCopiar.Bottom-RecCopiar.Top+2; for i:=1 to (stringgrid2.ColCount-1) do begin for j:=1 to (stringgrid2.RowCount-1)do begin stringgrid2.Cells[i,j]:=stringgrid1.Cells[i+RecCopiar.Left-1,j+RecCopiar.top-1]; if borrar then stringgrid1.Cells[i+RecCopiar.Left-1,j+RecCopiar.top-1]:=''; end; end; end; procedure TForm1.PegarSel; var i,j: integer; begin for i:=stringgrid1.Col to (Stringgrid1.Col+stringgrid2.ColCount-2) do begin for j:=stringgrid1.Row to (Stringgrid1.Row+stringgrid2.rowCount-2)do begin stringgrid1.Cells[i,j]:=stringgrid2.Cells[i+1-stringgrid1.Col,j+1-stringgrid1.Row] end; end; end; lo que tienes que modificar es en donde dice stringgrid1.cells[x,y] poner worksheet.Cells.Item[x,y] o algo similar. Suerte Es mi primer colaboracion en un foro, asi que si te sirvio me gustaria que lo digas asi lo sigo haciendo. ![]() |
| Herramientas | Buscar en Tema |
| Desplegado | |
|
|
|