Move Row to another Sheet if Specific Cells have Values.

noveske

Board Regular
Joined
Apr 15, 2022
Messages
120
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
Just want to move an entire row to another sheet once multiple cells have a value.
Sheet 1 - Has the item. Let's say cells H-I have date, method and person.

Once H-1 has values in it, then move to Sheet 2. Into the next blank cell.

If that's not possible, could be if H has a value, then move. To be done manually with a button.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Correction: Once H-1 has values in it, then move to Sheet 2. Into the next blank cell.
Should be H-I not H-1.
 
Upvote 0
Hi

So you want to copy a row from "sheet1" to "sheet2" if column H has data put in it?

try the below as a start

it copies the row where H has had data put in it.

please be aware though, it will keep copying the same data everytime you change that cell, unless we code in a trap

right click sheet 1 tab and paste this code in it, test on a copy dataset


VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 8 Then
    If Target.Cells > "" Then Rows(Target.Row).Copy Sheets("sheet2").Rows(Worksheets("sheet2").Cells(Rows.Count, 1).End(xlUp).Row + 1)
End If
End Sub
 
Upvote 0
Hi

So you want to copy a row from "sheet1" to "sheet2" if column H has data put in it?

try the below as a start

it copies the row where H has had data put in it.

please be aware though, it will keep copying the same data everytime you change that cell, unless we code in a trap

right click sheet 1 tab and paste this code in it, test on a copy dataset


VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 8 Then
    If Target.Cells > "" Then Rows(Target.Row).Copy Sheets("sheet2").Rows(Worksheets("sheet2").Cells(Rows.Count, 1).End(xlUp).Row + 1)
End If
End Sub
Ah. It would be for H2 and on.
It's for tracking an action. H would be a date or who completed it.
So the sheet would have an inventory.

Let's say H5 gets an input of completion.

A5:H5 would be moved to Sheet 2. Entire row.
 
Upvote 0
Ah. It would be for H2 and on.
It's for tracking an action. H would be a date or who completed it.
So the sheet would have an inventory.

Let's say H5 gets an input of completion.

A5:H5 would be moved to Sheet 2. Entire row.
I just tested my code, input something into H5 and it copied row 5(entire row) to sheet 2

is that not waht you wanted?

Is your data made up of formula?

Dave
 
Upvote 0
Solution
I just tested my code, input something into H5 and it copied row 5(entire row) to sheet 2

is that not waht you wanted?

Is your data made up of formula?

Dave

Tested it. Added to move the line. Just need to figure out how to make it when multiple cells contain values. 12, 13, 14.

Tried adding and statements. Failed. :(

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 14 Then
    If Target.Cells > "" Then Rows(Target.Row).Copy Sheets("sheet2").Rows(Worksheets("sheet2").Cells(Rows.Count, 1).End(xlUp).Row + 1)
    Target.EntireRow.Delete
End If
End Sub
 
Upvote 0
Tested it. Added to move the line. Just need to figure out how to make it when multiple cells contain values. 12, 13, 14.
Not sure i understand, are you not manually adding the data into the column(changed from 8-14 by the looks)

you want a code to check each row on sheet 1 and move it all over as bulk job to sheet 2 with a button?
 
Upvote 0
oh, you man if column 12,13,14 change?
 
Upvote 0
you could use

VBA Code:
If Target.Column = 14 Or Target.Column = 15 Or Target.Column = 16 Or Target.Column = 17 Then

or

VBA Code:
If Target.Column > 13 And Target.Column < 18 Then
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

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