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
精彩评论