MAKE MACRO/VBA TO MOVE ROW TO ANOTHER SPREADSHEET AND DELETE OLD ROW WHEN DATE AENTERED IN A CELL

Daleksec93

New Member
Joined
Aug 18, 2022
Messages
15
Office Version
  1. 365
Platform
  1. Windows
Hi Experts!

I have had a go at this myself and have only been able to do make this work when i initially put the code in. Does not continue to work there after.

I am trying to move a row to another sheet if I type "Z" in the "Job completed?" Column (A3-E218.) after row 3. row 3 is title on both sheet. sheet 1 is called CURRENT and sheet 2 is called REMOVED

I need this to happen instantly after typing "Z" in column A starting with row 4

Please let me know if there is any other information you will need to be able to help me with this.

Thank you!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Try the logic below and make required changes if you want:

VBA Code:
Dim currRow As Long
Private Sub Worksheet_Change(ByVal Target As Range)
currRow = ActiveCell.Row - 1
Sheets("Sheet1").Rows(currRow).Copy Sheets("Sheet2").Rows(currRow)
End Sub
 
Upvote 0
Try the logic below and make required changes if you want:

VBA Code:
Dim currRow As Long
Private Sub Worksheet_Change(ByVal Target As Range)
currRow = ActiveCell.Row - 1
Sheets("Sheet1").Rows(currRow).Copy Sheets("Sheet2").Rows(currRow)
End Sub
this will move them based on adding a "Z" to column A automatically?
 
Upvote 0
Put the code in the sheet where you are typing (Sheet1 in this case)
 
Upvote 0
Type Z and press Enter, it will move
it does not work. The other ones i saw and looked through i changed proper information and it still not work. there was more to those than this though. it does not show which column is being targeted for change to Z and it does not show automatically script
 
Upvote 0
THE MODULES OF COURSE
I have columns A-AP that need to moved over with it. so the entire row goes to other sheet in the first available row when Z is entered in coloumn A starting with row 3 row 2 is header
 
Upvote 0
Try this. Right click on the sheet tab name for the sheet "CURRENT", select View Code, copy the code below to the window that appears on the right of the screen. Save the file & test it by typing a "Z" in column A of the "CURRENT sheet. As always, test this with a copy of your file.

VBA Code:
Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Cells.CountLarge = 1 And Not Intersect(Range("A4", Cells(Rows.Count, "A").End(xlUp)), Target) Is Nothing Then
    If Target.Value <> "Z" Then Exit Sub
    Dim lRow As Long
    lRow = Sheets("REMOVED").Cells.Find("*", , xlFormulas, , 1, 2).Row + 1
    With Target.EntireRow
        .Copy Sheets("REMOVED").Cells(lRow, 1)
        .Delete xlUp
    End With
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,183
Messages
6,123,522
Members
449,103
Latest member
Michele317

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