Afternoon all
I've been working on a spreadsheet. I had no VBA knowledge at all, now I still have close to none! I've been searching various forums and websites and copied and pasted code in a trial and error way, sometimes successfully, sometimes not. I'm stuck now though. I've seen lots of similar questions and experimented with the answers provided, but can't get it to work.
I want two macros to run on my workbook. One is for when a city is chosen from a drop down menu, that row gets copied into the corresponding city worksheet. Secondly, when 'Completed' is chosen from a drop down menu on another column, I want that row to be moved to the Completed spreadsheet.
I've got the following code:
The city part works fine. The second part only deletes the row. I want it copied and pasted first, then delete, or just moved. I can't work out what code to add in though and how.
I've been working on a spreadsheet. I had no VBA knowledge at all, now I still have close to none! I've been searching various forums and websites and copied and pasted code in a trial and error way, sometimes successfully, sometimes not. I'm stuck now though. I've seen lots of similar questions and experimented with the answers provided, but can't get it to work.
I want two macros to run on my workbook. One is for when a city is chosen from a drop down menu, that row gets copied into the corresponding city worksheet. Secondly, when 'Completed' is chosen from a drop down menu on another column, I want that row to be moved to the Completed spreadsheet.
I've got the following code:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 6 Then
tRow = Target.Row
Range("F" & tRow).EntireRow.Copy Sheets("London").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Range("F" & tRow).EntireRow.Copy Sheets("Manchester").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Range("F" & tRow).EntireRow.Copy Sheets("Leeds").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Range("F" & tRow).EntireRow.Copy Sheets("Birmingham").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Range("F" & tRow).EntireRow.Copy Sheets("Cardiff").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End
If Application.EnableEvents = False
If Target.Column = 9 Then
tRow = Target.Row
Range("I" & tRow).EntireRow.Delete Sheets("Completed").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End If
Application.EnableEvents = True
End Sub
The city part works fine. The second part only deletes the row. I want it copied and pasted first, then delete, or just moved. I can't work out what code to add in though and how.