Here's my 2 cents worth: it works with a selection as you asked
Sub tryme()
firstrow = ActiveCell.Row
lastrow = Selection.Rows.Count
j = 1
For k = firstrow To lastrow
If Cells(k, "C") = Cells(k, "D") Then
Cells(k, "A").EntireRow.Copy Worksheets("sheet2").Cells(j, "A")
j = j + 1
End If
Next k
End Sub
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email
"ub" wrote in message
...
Hi
I want to write a vba code in "Sheet2", to select rows from "Sheet1" based
on my condition and then paste those rows in defined range in "Sheet2"
Example
I want to select rows in sheet1 where the condition is that cell value
c3=d3, I have 500 rows. Now the rows that meet the condition, I want them
to
be displayed in sheet 2 in the cell range starting from a20 to a2000
Please advise