View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Dennis
 
Posts: n/a
Default Copy/Paste how to avoid the copy of formula cells w/o calc values

Using 2003

Sheet1: Current macro calculates a range of cells from a fixed upper-left
range cells F5 to G200.: (Note that Sheet1 is a Pivot-table already using
Auto filter.)

Sheets("Pivot Table").Range(Cells(5, "F").Address, Cells _
(Rows.Count, "G").End(xlUp).Address).Copy

(followed by:)

Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks:=True, Transpose:=False

I would prefer that the copy command would evaluate only the cells whose
formula calculates a value. By this I mean: Many of the cells in the F5 to
G200 range do not have a calculated value. Assuming that only 5 rows have
values, the copy command will copy the calculated range F5 to G200, meaning
that 195 two-column cell combinations will be pasted to the receiving range
wasting space on Sheet2.

My macros then copy another range from Sheet3 beginning at row 201. (Again,
there are 195 essentially wasted rows between the cells pasted from Sheet1)

I have attempted to Copy using VisibleCells and/or Paste-special SkipBlanks
= True - yet I still get the 195 "Wasted-space" cells.

It seems that there are three solutions:
One is a smarter way to copy only the cells that the
underlying formula calculates a value.

-or-

Another, is to Paste only those cells from Sheet1 which
have values (text or numeric)

-or-

Develope a routine to delete the empty rows on Sheet2.

Which of the three is the smartest/most efficient?

I need help with coding the syntax in VBA.

Thanks, Dennis