ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   moving a row between worksheets (https://www.excelbanter.com/new-users-excel/9894-moving-row-between-worksheets.html)

Amit

moving a row between worksheets
 
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!



galimi

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

"Amit" wrote:

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

This is awesome, thanks Galimi!

"galimi" wrote in message
...
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

"Amit" wrote:

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!







All times are GMT +1. The time now is 10:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com