P
PVANS
Good morning,
I am currently using the following basic code to copy the contents of a
worksheet to another worksheet:
Sheets("DT Master").Select
Cells.Select
Selection.Copy
Sheets("DT CFD Open Positions").Select
Range("A1").Select
ActiveSheet.Paste
However, I have now discovered, that there are several rows of data within
the worksheet that should not be moved to the other worksheet, but instead be
placed on their own worksheet in the workbook.
The Column that determines which worksheet they need to be copied to is
Column D. If the cell begins with "C0", then it needs to be copied to a new
worksheet named "DT Retail"; if it begins with any other two characters, it
needs to be copied to the "DT CFD Open Positions" worksheet.
I think the best way to achieve this would be to use an IF ELSE statement.
However, as a result of further code run modifications of the data in "DT CFD
Open Positions", I would like the IF statement to first deal with the "DT
Retail" data, and then the "DT CFD Open Positions" data, ie:
IF column D starts with C0,
Copy rows to "DT Retail"
ELSE column D does not start with C0,
Copy rows to "DT CFD Open Positions"
Can someone please help me with the correct syntax and code? I would really
appreciate the help
Regards
I am currently using the following basic code to copy the contents of a
worksheet to another worksheet:
Sheets("DT Master").Select
Cells.Select
Selection.Copy
Sheets("DT CFD Open Positions").Select
Range("A1").Select
ActiveSheet.Paste
However, I have now discovered, that there are several rows of data within
the worksheet that should not be moved to the other worksheet, but instead be
placed on their own worksheet in the workbook.
The Column that determines which worksheet they need to be copied to is
Column D. If the cell begins with "C0", then it needs to be copied to a new
worksheet named "DT Retail"; if it begins with any other two characters, it
needs to be copied to the "DT CFD Open Positions" worksheet.
I think the best way to achieve this would be to use an IF ELSE statement.
However, as a result of further code run modifications of the data in "DT CFD
Open Positions", I would like the IF statement to first deal with the "DT
Retail" data, and then the "DT CFD Open Positions" data, ie:
IF column D starts with C0,
Copy rows to "DT Retail"
ELSE column D does not start with C0,
Copy rows to "DT CFD Open Positions"
Can someone please help me with the correct syntax and code? I would really
appreciate the help
Regards