Move Row to another Sheet if Date is In a Colum

ryanf88

New Member
Joined
Mar 26, 2013
Messages
18
Hello

I have an excel worksheet with K Columns with info starting on Row 5 to 30
I would like to move a row to the second sheet if a date has been put under Column I which is called "Closed Date"
It will delete the row from Sheet1 and put it to the top row in Sheet2. For example the info from Sheet1 say Row 6 will be put into Sheet2 on Row 5 with the rest of the info moving down on sheet2 to allow for the inserted line to go in.

Is this even possible?

If not is it easier to delete it from Sheet1 and insert it at the next available row on Sheet2.


I am using Excel 2007 and am not very familiar with recording a macro so that wont work.


Thank-you for anyone who responds.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Code:
Sub a()
Set sh1 = Sheets(1)
Set sh2 = Sheets(2)
LR1 = sh1.Cells(Rows.Count, "B").End(xlUp).Row
drow = 5
For j = 5 To LR1
  If sh1.Range("I" & j) <> "" Then
    sh1.Rows(j).Copy sh2.Range("A" & drow)
    sh1.Rows(j).Delete
    j = j - 1
    drow = drow + 1
  End If
Next
End Sub
 
Upvote 0
Code:
Sub a()
Set sh1 = Sheets(1)
Set sh2 = Sheets(2)
LR1 = sh1.Cells(Rows.Count, "B").End(xlUp).Row
drow = 5
For j = 5 To LR1
  If sh1.Range("I" & j) <> "" Then
    sh1.Rows(j).Copy sh2.Range("A" & drow)
    sh1.Rows(j).Delete
    j = j - 1
    drow = drow + 1
  End If
Next
End Sub

Thank-you so much for the code.
Is there a way to make this run without pressing the play button each time in excel? (Not sure if it is a setting or part of code)
 
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,385
Members
448,956
Latest member
JPav

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