View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Arvi Laanemets Arvi Laanemets is offline
external usenet poster
 
Posts: 510
Default Excel2000: Copy all exept data

Hi

Below is a code snippet from my procedure. When NewNumAllNumAll, then it
copies last 4 rows of used range and pastes for 4*n rows down. The copied
range contains formatted cells (border, color, font, cell merging) + for
some cells the conditional formatting is used, or data validation, and in
some cells are formulas. All this must be copied. But sometimes there can be
also data (user entries) in some cells, which is the cause of my problem.
.....
Select Case NewNumAll
Case Is < NumAll
Sheets("JooksevKuu").Range((9 + 4 * NewNumAll) & ":" &
LastRow).Delete
Case Is NumAll
Sheets("JooksevKuu").Range((LastRow - 3) & ":" & LastRow).Copy
(Sheets("JooksevKuu").Range((LastRow + 1) & ":" & 8 + 4 * NewNumAll))
End Select
.....

There is no problem until last 4 rows in table aren't filled by user. But
when they are, all those data are duplicated in added rows. Of-course it's
possible to clear all entries from added rows after copying (2 ranges to
clear), but maybe there is a way to copy formulas and formats by code,
leaving out all user entries.

Thanks in advance

--
Arvi Laanemets
(When sending e-mail, use address arvil<Attarkon.ee)