View Single Post
  #8   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

This should be faster

Sub abc()
Dim rng As Range
Dim s As Long
Dim cell As Range
v = Range("Q5:R2000").Value
j = 1
For i = LBound(v, 1) To UBound(v, 1)
If IsNumeric(v(i, 1)) Then
v(j, 1) = v(i, 1)
v(j, 2) = v(i, 2)
j = j + 1
End If
Next
Range("T5").Resize(j - 1, 2).Value = v

End Sub

--
Regards,
Tom Ogilvy



wrote in message
oups.com...
Thx for all your help Tom....I appreciate it.

I've tried the 2nd suggestion above but it does not work (the xlshiftUp
one). It copies the range correctly but does not remove the blank
cells. I tried something similar using the macro recorder. It will do
the job but I have formulas that refer to the destination cells. After
the xlshiftup process the formulas have #REF! where the cell locations
use to be.

Overall I still cannot beat the spead of the copy/paste method using
the clipboard. Your last suggestion comes the closest as far as
beating the clipboard.