开发者

How do you copy one column in one sheet to another column in a different sheet, while skipping over blank cells?

I have a one sheet with a column which ranges from C2 till C6开发者_开发问答115. In that range there are many empty cells. I want to copy the filled cells only into a seperate sheet using VB in excel 2007. Can anyone give me a general code that can help me perform that?


Sub copy()
Dim i As Long
Dim cell As Range
i = 1
For Each cell In Sheets(1).Range("c2:c6115")
    If Not IsEmpty(cell) Then
        Sheets(2).Range("c" & i).Value = cell.Value
        i = i + 1
    End If
Next cell
End Sub
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜