ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy range (https://www.excelbanter.com/excel-programming/403166-copy-range.html)

[email protected]

Copy range
 
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?

joel

Copy range
 
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


" wrote:

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?


[email protected]

Copy range
 
On Dec 22 2007, 7:07*pm, Joel wrote:
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



" wrote:
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?- Hide quoted text -


- Show quoted text -


Joel,

I just recently had a chance to review your response.

Thanks for your help.

Frank


All times are GMT +1. The time now is 06:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com