PDA

View Full Version : Help , copy cells with condition



NNDRIANA
03-30-2012, 02:33 AM
Hi,

this code copy cells from sheet "2" to sheet "1".
I want to add a code allowing me to copy with a condition these value.
here is my file.

Regards.

Sub Macro1()
Dim i As Integer, derlig As Long
With Sheets("2")
lastlig = .Range("A" & .Rows.Count).End(xlUp).Row
For i = 2 To lastlig
Sheets("1").Cells(i, 4) = .Cells(i, 2)
Sheets("1").Cells(i, 5) = .Cells(i, 2).Offset(0, 1)
Next i
End With
End Sub

Bob Phillips
03-30-2012, 02:54 AM
What does ... copy with a condition these value ... mean, what condition?

NNDRIANA
03-30-2012, 03:12 AM
Ok!
In sheets "1",with column A,
I have 1 to 14 as value,
In sheets "2" ,with column A,these value are not the same.
I need just to report these value by a condition.
A condition which use column A on both sheets.
please look at my attachements files.

best regards.

NNDRIANA
03-30-2012, 03:39 AM
Sorry may be my explication is not clear.
I try again to explain my aims.
in the first sheet "1" I have a value "1 to 14", the second sheet "2" also except that there are values ​​that we can not find in sheet "1"
So how can I copy the values ​​from column B and C in a sheet "2" to column D and E in sheet "1" by a condition based on the values ​​in column A of the two sheets.

regards.