Anthony2687
New Member
- Joined
- Jan 5, 2012
- Messages
- 37
Hello All,
With the help of this forum I have create the below Code, but it just hit me that I may run into instances where this code That copies data and pastes it to a tab by a cell reference may infact stop if the cell reference encounters a time where a tab doesnt share its name.
So If you could, I need you assistance again. How would you recommend I add the second code into the larger first code? I'm thinking maybe an if statment where I've bolded the code?
<TBODY>
</TBODY><COLGROUP><COL></COLGROUP>
With the help of this forum I have create the below Code, but it just hit me that I may run into instances where this code That copies data and pastes it to a tab by a cell reference may infact stop if the cell reference encounters a time where a tab doesnt share its name.
So If you could, I need you assistance again. How would you recommend I add the second code into the larger first code? I'm thinking maybe an if statment where I've bolded the code?
Sub Loop1()</SPAN> |
Do</SPAN> |
Sheets("Sheet2").Range("$A$1:$K$199").AutoFilter Field:=4, Criteria1:=Range("A201").Value, Operator:=xlAnd</SPAN> |
Range("A2:K200").Select</SPAN> |
Application.CutCopyMode = False</SPAN> |
Selection.Copy</SPAN> |
Sheets(Sheet2.Range("A201").Text).Select</SPAN> |
Cells(Rows.Count, "A").End(xlUp)(2).Select</SPAN> |
ActiveSheet.Paste</SPAN> |
Sheets("Sheet2").Select</SPAN> |
Rows("201:201").Select</SPAN> |
Application.CutCopyMode = False</SPAN> |
Selection.Delete</SPAN> |
Loop Until IsEmpty(ActiveCell)</SPAN> |
End Sub Sheets.Add After:=Sheets(Sheets.Count) ActiveSheet.Paste ActiveSheet.Name = Range("D2").Value</SPAN> |
<TBODY>
</TBODY><COLGROUP><COL></COLGROUP>