moving a row between worksheets

  • Thread starter Thread starter Amit
  • Start date Start date
A

Amit

I want to write VBA code that does the following: When a value in column E
is changed to "John" that entire row is moved to a worksheet (in the same
spreadsheet) called "Assigned". Is this possible? Thanks!
 
Amit,

I've uploaded the file with code to http://Galimi.com/Examples/MS.xls

Following is the code to be embedded as a Change event on the sheet that
recognizes the word John:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 5 Then
If Target.Value = "John" Then
'Move the column to the Assigned sheet
Rows(Target.Row).Copy
shtAssigned.Rows(shtAssigned.UsedRange.Rows.Count + 1)

End If
End If

End Sub

http://HelpExcel.com
 
This is awesome, thanks Galimi!

galimi said:
Amit,

I've uploaded the file with code to http://Galimi.com/Examples/MS.xls

Following is the code to be embedded as a Change event on the sheet that
recognizes the word John:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 5 Then
If Target.Value = "John" Then
'Move the column to the Assigned sheet
Rows(Target.Row).Copy
shtAssigned.Rows(shtAssigned.UsedRange.Rows.Count + 1)

End If
End If

End Sub

http://HelpExcel.com
 
Back
Top