ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Rows using criteria (https://www.excelbanter.com/excel-programming/402867-copy-rows-using-criteria.html)

Carpe Diem

Copy Rows using criteria
 
Hi ,

I have a data with about 4500 rows and 12 columns. I would like to
copy only the rows where column C haven't "0" value.can someone hep me
with a macro ?


Example

Thank you

Dan R.

Copy Rows using criteria
 
Try this:

Sub Copy()
Dim lRow As Long, rng As Range, i As Range
lRow = Range("C65536").End(xlUp).Row
Set rng = Range(Cells(1, 3), Cells(lRow, 3))

a = 1
For Each i In rng
If i.Value < "0" Then
i.EntireRow.Copy Sheets(2).Rows(a)
a = a + 1
End If
Next i
End Sub

--
Dan

On Dec 17, 10:46 am, Carpe Diem wrote:
Hi ,

I have a data with about 4500 rows and 12 columns. I would like to
copy only the rows where column C haven't "0" value.can someone hep me
with a macro ?

Example

Thank you




All times are GMT +1. The time now is 01:25 PM.

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