PDA

View Full Version : I Need help edit code copy and past



etheer
11-24-2012, 07:23 AM
http://im29.gulfup.com/Nv7n1.jpg

Hi
I have code work very good copy from cell to another cell but i need edit it
If in cell G number not past agian new number from cell A



Private Sub Worksheet_Calculate()
Dim c As Range
Application.EnableEvents = False
On Error Resume Next
For Each c In Range("E7:E" & Cells(Rows.Count, "E").End(xlUp).Row)
If c = "Yes" Then
With c
.Offset(, 1).Value = "Yes"
.Offset(, 2).Value = .Offset(, -4).Value
End With
End If
Next c
Application.EnableEvents = True
End Sub



Please help me

patel
11-24-2012, 08:47 AM
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("E7:E" & Cells(Rows.Count, "E").End(xlUp).Row)) Is Nothing Then
If Target = "Yes" Or Target = "yes" Then
With Target
.Offset(, 1).Value = "Yes"
.Offset(, 2).Value = .Offset(, -4).Value
End With
End If
End If
End Sub

etheer
11-24-2012, 02:23 PM
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("E7:E" & Cells(Rows.Count, "E").End(xlUp).Row)) Is Nothing Then
If Target = "Yes" Or Target = "yes" Then
With Target
.Offset(, 1).Value = "Yes"
.Offset(, 2).Value = .Offset(, -4).Value
End With
End If
End If
End Sub

Thank you :thumb