PDA

View Full Version : Copy row to exisiting tab and then delete



mykal66
03-14-2017, 01:53 AM
Hi everyone.

I have found some code /an example workbook (attached) that will copy a row of data to the appropriate worksheet in the same workook when a selection is made in the outcome column which work fine but one of my colleages needs to choose additional outcomes where there is not a matching tab which then causes the macro to break.

e.g. the owing tab is the main tab so when they select the outcome paid or withdrawn in column I that row is moved the the matching tab which works, if they choose 'Test' or any other oucome they want i need it to be ignored and left where it is as the TAB does not exist.

I have found some code that will allow me to do this and define the criteria e.g. if it says withdrawn, if it says paid but i need it is to just match anything if th tab exists as they keeping adding new criteria

Can anyone help please, and thank you in advance?



Mykal

18632

mana
03-17-2017, 05:25 AM
Dim ws As Worksheet
On Error Resume Next
Set ws = Worksheets(Target.Value)
On Error GoTo 0
If ws Is Nothing Then Exit Sub