Automatically move rows to another worksheet

el12345

New Member
Joined
Oct 1, 2020
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hello,
I am trying to set up a new document to track clients, I have included a screenshot.
For each worksheet, I want to be able to enter the status in column N which will transfer the specific row to whichever worksheet I have specified in the status (New Enquiries, Consultations, Quotes To Do, To Book, Live, Booked, Finished). Please can anyone tell me how to do this? Also, it is a problem that I have used a merged cell and table?
Thank you so much!
 

Attachments

  • Screenshot.PNG
    Screenshot.PNG
    47.5 KB · Views: 25

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hello

This is how you would do it (can you give details on the merged cell and table details).

VBA Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Application.EnableEvents = False
    If Target.Column = 14 Then
        Rows(Target.Row).Copy
        Sheets(Target.Value).Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial (xlPasteAll)
        Rows(Target.Row).Delete
    End If
    Application.EnableEvents = True
End Sub

This code needs to go in the THIS WORKKBOOK code window, not a standard module.
 
Upvote 0
Hello

This is how you would do it (can you give details on the merged cell and table details).

VBA Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Application.EnableEvents = False
    If Target.Column = 14 Then
        Rows(Target.Row).Copy
        Sheets(Target.Value).Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial (xlPasteAll)
        Rows(Target.Row).Delete
    End If
    Application.EnableEvents = True
End Sub

This code needs to go in the THIS WORKKBOOK code window, not a standard module.

Thanks so much for your reply! Do I need to edit anything in this in order for it to work? I have gone to a tab in the workbook, selected view code and then changed on the drop down to Workbook_SheetChange, is that the correct way? I'm not too experienced with this! With regards to the merged cell and table, I had seen in a different thread that a merged cell may affect the VBA, so I was unsure if my merged cell A1-N1 would stop this from working.

Thanks again
Elena
 
Upvote 0
I had seen in a different thread that a merged cell may affect the VBA, so I was unsure if my merged cell A1-N1 would stop this from working.
Yes, merged cells are one of the most problematic features of Excel, and really should be avoided whenever possible. They wreak havoc with things like sorting and VBA.

Note then when merging columns across a single row (like A1-N1), using the "Center Across Selection" formatting option will give you the same visual effect as merged cells, but without all the problems merged cells cause.

See here: Tom’s Tutorials For Excel: Using Center Across Selection Instead of Merging Cells – Tom Urtis
 
Upvote 0
Yes, merged cells are one of the most problematic features of Excel, and really should be avoided whenever possible. They wreak havoc with things like sorting and VBA.

Note then when merging columns across a single row (like A1-N1), using the "Center Across Selection" formatting option will give you the same visual effect as merged cells, but without all the problems merged cells cause.

See here: Tom’s Tutorials For Excel: Using Center Across Selection Instead of Merging Cells – Tom Urtis

Brilliant! Thank you - I removed the merged cell and the VBA worked :) it was also putting the data at the end of the table that I been putting my data in, so I have converted them back to normal.
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,432
Members
452,326
Latest member
johnshaji

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