Copy range

  • Thread starter Thread starter wfgfreedom
  • Start date Start date
W

wfgfreedom

I have copied data from several excel sheets to a summary sheet, but
it contains data that I don't want included. On the summary sheet, I
would like to copy only the rows of data that do not include a zero in
column K of that row over to another area of that sheet. This area
would then display only the data I want to see without any spaces
between rows where the missing data would have been.

Is there an easy way to do this?
 
Sub copy_non_zero()

LastRow = Range("K" & Rows.Count).End(xlUp).Row
NewRowCount = 1
For RowCount = 1 To LastRow
If Range("K" & RowCount) <> 0 Then
Set SourceRange = Range("A" & RowCount & ":K" & _
RowCount)

SourceRange.Copy Destination:= _
Range("AA" & NewRowCount)

NewRowCount = NewRowCount + 1
End If
Next RowCount
End Sub
 
Sub copy_non_zero()

LastRow = Range("K" & Rows.Count).End(xlUp).Row
NewRowCount = 1
For RowCount = 1 To LastRow
   If Range("K" & RowCount) <> 0 Then
      Set SourceRange = Range("A" & RowCount & ":K" & _
         RowCount)

      SourceRange.Copy Destination:= _
         Range("AA" & NewRowCount)

      NewRowCount = NewRowCount + 1
   End If
Next RowCount
End Sub






- Show quoted text -

Joel,

I just recently had a chance to review your response.

Thanks for your help.

Frank
 

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

Back
Top