View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default copy rows to other sheet

Hi,

Because you put 0 in quotes i'm not sure if you meant zero or the letter O
so this assumes zero and copies sheet 1 to sheet 2. Alt+F11 to open VB editor
insert a module and paste this in and try it:-

Sub copyit()
Dim MyRange, MyRange1 As Range
Sheets("Sheet1").Select
LastRow = Sheets("Sheet1").Range("C65536").End(xlUp).Row
Set MyRange = Sheets("Sheet1").Range("C1:C" & LastRow)
For Each C In MyRange
If C.Value < 0 Then
If MyRange1 Is Nothing Then
Set MyRange1 = C.EntireRow
Else
Set MyRange1 = Union(MyRange1, C.EntireRow)
End If
End If
Next
MyRange1.Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
ActiveSheet.Paste
End Sub


Mike


"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