Skipping empty cells for a Range object?

Z

Zilla

In VBA..

Is it possible to set a Range object to skip empty cels? IOW, if I
copy A1:A10, and A5 is empty, and transpose them on B20, I want to
skip A5; I did SkipBlanks:=True and it still pasted the blank cells.
Incidentally, doing it via Paste Special wizard, and checking skip
blank cells produces the same result.
 
G

Gary''s Student

Straight copy (no trasnpose):

Sub skip_copy()
For i = 1 To 10
v = Cells(i, 1).Value
If IsEmpty(v) Then
Else
Cells(i, 1).Copy Cells(i + 19, 2)
End If
Next
End Sub


With transpose:

Sub skip_copy()
For i = 1 To 10
v = Cells(i, 1).Value
If IsEmpty(v) Then
Else
Cells(i, 1).Copy Cells(20, i+1)
End If
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top