Hello,
hey guys i need help in excel.... assignment in my row F I have 2 data Permanent and contract. So i want to make it that when I type it in sheet 1 Row F Permanent it will go and copy to sheet 2 row F and when i type contract it will copy to sheet 3 row F.... It is possible?
Configuration: Windows XP Safari 530.17
You have not answered my second question. I assumed that you want the word permanent or contract if entered in sheet 1 column F this entry will be copied in the column F of sheet 2 or sheet 3 accordingly.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 6 Then Exit Sub
Target.Copy
If Target = "permanent" Then
With Worksheets("sheet2")
.Cells(Rows.Count, "F").End(xlUp).Offset(1, 0).PasteSpecial
End With
ElseIf Target = "contract" Then
With Worksheets("sheet3")
.Cells(Rows.Count, "F").End(xlUp).Offset(1, 0).PasteSpecial
End With
Else
Exit Sub
End If
application.CutCopyMode=false
End Sub |
The macro is slightly modified
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 6 Then Exit Sub
If Target = "permanent" Then
Range(Cells(Target.Row, "A"), Cells(Target.Row, "I")).Copy
With Worksheets("sheet2")
.Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial
End With
ElseIf Target = "contract" Then
Range(Cells(Target.Row, "A"), Cells(Target.Row, "I")).Copy
With Worksheets("sheet3")
.Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial
End With
Else
Exit Sub
End If
Application.CutCopyMode = False
End Sub
|
Your question is not clear. I am trying to rephrase it. see whether it is ok
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column > 9 Then Exit Sub
if Target="" then exit sub
If Target = "permanent" Then
Range(Cells(Target.Row, "A"), Cells(Target.Row, "I")).Copy
With Worksheets("sheet2")
.Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial
End With
ElseIf Target = "contract" Then
Range(Cells(Target.Row, "A"), Cells(Target.Row, "I")).Copy
With Worksheets("sheet3")
.Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial
End With
Else
Exit Sub
End If
Application.CutCopyMode = False
End Sub
|