Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / December 2007

Tip: Looking for answers? Try searching our database.

Copy Rows using criteria

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Carpe Diem - 17 Dec 2007 16:46 GMT
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. - 17 Dec 2007 17:01 GMT
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

> Hi ,
>
[quoted text clipped - 5 lines]
>
> Thank you
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.