Moving entire row to new sheet when date is entered

Foxy Lady

New Member
Joined
Feb 25, 2009
Messages
41
Hi there,

I wonder if any one can help me.

I want to move an entire row in spreadsheet A to the next empty line in Spreadsheet 2 if a date(any) is entered into column J.

Can this be done??

Regards

Foxylady
 
Hi there Peter,

Thank a lot, it is working with the new code, however I found that if I made a change to anything in the row I first need to re-enter the date in Column I to update the row in the new sheet.
If it is the only way then it is fine.
I wish everyone can reply as quick as you with the correct syntax.
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Try this: right click the tab of spreadsheet A, select View Code and paste in

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 10 And IsDate(Target.Value) Then
    Application.EnableEvents = False
    With Target.EntireRow
        .Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
        .Delete
    End With
End If
End Sub

Press ALT + Q to return to your sheet.

This code works great, but I find it only works at times and I don't understand why. I have tried changing cells format and tried different things but it is still intermittent. The first time I try it in a day works fine, but then nothing helps. Reopening the file either.

Any ideas?

I don't have the requirement to use date specifically, just any text entered in a cell should move whole row to second tab.
 
Upvote 0
Try closing then re-opening Excel then use

Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 10  Then
    Application.EnableEvents = False
    With Target.EntireRow
        .Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
        .Delete
    End With
    Application.EnableEvents = True
End If
End Sub
 
Upvote 0
Try closing then re-opening Excel then use

Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 10  Then
    Application.EnableEvents = False
    With Target.EntireRow
        .Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
        .Delete
    End With
    Application.EnableEvents = True
End If
End Sub

After some initial issues I think it is working now. Thank you very much!
 
Upvote 0

Forum statistics

Threads
1,215,051
Messages
6,122,871
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top