Moving rows to other spreadsheets based on cell value

paullyv33

New Member
Joined
Mar 25, 2011
Messages
7
I would like to create a macro so that when the value in any cell from C3:C5000 is "Dropout" in the spreadsheet "Hoopers", that the cell's corresponding row (including the cell itself) be cut/moved to the first available row in another spreadsheet labeled "Dropout."

Then, after that row is moved, the resulting empty row is automatically deleted.

I would appreciate any help you could offer. Thank you.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Welcome to MrExcel board....

Try this

Code:
Sub Transfer_data()
Dim i As Long, LR As Long, ALR As Long
Dim MFile As String, DFile As String
MSht = "Hoopers"
Dsht = "Dropout"
Sheets(MSht).Activate
LR = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
ALR = Sheets(Dsht).Range("A" & Rows.Count).End(xlUp).Row + 1
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'filter for dropout data
    Cells.AutoFilter
    Cells.AutoFilter Field:=3, Criteria1:="Dropout"
    Range("C3:C" & LR).SpecialCells(xlCellTypeVisible).Select
    Range("A3:D" & LR).Copy Destination:=Sheets(Dsht).Cells(ALR, 1)
    Range("C3:C" & LR).EntireRow.Delete
    Cells.AutoFilter
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thank you, texasalynn.

Unfortunately it did not seem to work on my spreadsheet. I am unsure as to why...

The column that would have the value "Dropout" extends from C3:C5000 and the rows range from A:AM.
 
Upvote 0
so is "Dropout" in the cell alone or is it with other words? (i.e. Dropout Now, Drop Later, etc)
 
Upvote 0
Thank you, texasalynn.

Unfortunately it did not seem to work on my spreadsheet. I am unsure as to why...

The column that would have the value "Dropout" extends from C3:C5000 and the rows range from A:AM.

So maybe I need a little more information. What doesn't seem to work? Nothing happened, something happened but not what you want, Code gives an error? Please give more specific information
 
Upvote 0
Sorry for the lack of details.

I copied your code into a VBA module, saved it, and when I returned to my spreadsheet and entered "Dropout" in any of the cells in column C, nothing happened.
 
Upvote 0
I was able to run the Macro and it actually works extremely well. Thank you very much. Earlier, I had assigned the wrong Macro (not yours) to the button, which is why I could not get it to work.

My only issue now is that the same row that will move (the one with "Dropout" in column C), has values in it from A:AM. When I run your macro, the only values that transfer to the "Dropout" spreadsheet are from columns through D; the values from columns E to AM do not transfer.
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,894
Members
452,948
Latest member
Dupuhini

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