View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Copy (removing blank cells) without clipboard

You can try my other suggestion, but here is a refinement of the first.

Dim rng as Range
Dim s as Long
Dim cell as Range
s = 5
set rng = Range("Q5:Q2000").SpecialCells(xlFormulas,1)
for each cell in rng
cells(s,"S").Resize(1,2).Value = _
cell.Resize(1,2).Value
s = s + 1
Next

--
Regards,
Tom Ogilvy

wrote in message
ups.com...
I've implemented your recommendation. I was surprised that it was
slower than using the clipboard. I think it can be speeded up. Here's
my idea. The source data range is Q5:R2000. Whenever there is a value
in column Q there is also a value in column R. For example, if there
is a value in Q5 then there is also a value in R5. Both these values
need to be copied to S5 and T5 respectively. Is it possible check for
the existance of a value in column Q and then paste the values from
columns Q and R to S and T? (It also has to remove the blank cells
from columns Q and R (as it does in you suggestion above)). If this is
possible then it only has to loop through 1/2 of the cells instead of
all the cells.

thx for your help.