J
jeff
Hi,
Here is some code that will run whenever a change is
made on your sheet. Adjust it to move what and when
you need.
jeff
Private Sub Worksheet_Change(ByVal Target As Range)
'exit if change is not in col c-e
If Intersect(Target, Me.Range("c:e")) Is Nothing Then
Exit Sub
' if value is nonzero simple copy over
'If Target.Value <> 0 Then Target.Offset(0, 4) =
Target.Value
' do a paste special on target only
If Target.Value <> 0 Then
Target.Select
Selection.Copy
Target.Offset(0, 4).Select
Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
' another way to copy and paste (but not special)
'If Target.Value <> 0 Then
' Target.Copy Destination:=Target.Offset(0, 4)
End If
' use these if you want to copy cols D & E whenever C is
changed
'If Target.Offset(0, 1) <> 0 Then Target.Offset(0, 4) =
Target.Offset(0, 1).Value
'If Target.Offset(0, 2) <> 0 Then Target.Offset(0, 3) =
Target.Offset(0, 2).Value
End Sub
Here is some code that will run whenever a change is
made on your sheet. Adjust it to move what and when
you need.
jeff
Private Sub Worksheet_Change(ByVal Target As Range)
'exit if change is not in col c-e
If Intersect(Target, Me.Range("c:e")) Is Nothing Then
Exit Sub
' if value is nonzero simple copy over
'If Target.Value <> 0 Then Target.Offset(0, 4) =
Target.Value
' do a paste special on target only
If Target.Value <> 0 Then
Target.Select
Selection.Copy
Target.Offset(0, 4).Select
Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
' another way to copy and paste (but not special)
'If Target.Value <> 0 Then
' Target.Copy Destination:=Target.Offset(0, 4)
End If
' use these if you want to copy cols D & E whenever C is
changed
'If Target.Offset(0, 1) <> 0 Then Target.Offset(0, 4) =
Target.Offset(0, 1).Value
'If Target.Offset(0, 2) <> 0 Then Target.Offset(0, 3) =
Target.Offset(0, 2).Value
End Sub