Alex Barrosse
New Member
- Joined
- Jul 14, 2011
- Messages
- 8
Hi all,
I've got a macro set up that opens two workbooks, copies and pastes a column containing department codes from workbook 1 into workbook 2, sheet 2, like so:
<TABLE style="WIDTH: 108pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=144><COLGROUP><COL style="WIDTH: 48pt" width=64><COL style="WIDTH: 60pt; mso-width-source: userset; mso-width-alt: 2925" width=80><TBODY><TR style="HEIGHT: 39pt" height=52><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; BACKGROUND-COLOR: #ffcc99; WIDTH: 48pt; HEIGHT: 39pt; BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid" class=xl67 height=52 width=64>ABC_XYZ </TD><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 60pt; BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid" class=xl70 width=80></TD></TR><TR style="HEIGHT: 39pt" height=52><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; BACKGROUND-COLOR: #ffcc99; WIDTH: 48pt; HEIGHT: 39pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl67 height=52 width=64>BCD_XYZ</TD><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 60pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl70 width=80></TD></TR><TR style="HEIGHT: 39pt" height=52><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; BACKGROUND-COLOR: #ffcc99; WIDTH: 48pt; HEIGHT: 39pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl67 height=52 width=64>CDE_XYZ </TD><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 60pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl70 width=80>Y </TD></TR><TR style="HEIGHT: 39pt" height=52><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; BACKGROUND-COLOR: #ffcc99; WIDTH: 48pt; HEIGHT: 39pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl67 height=52 width=64>DEF_XYC </TD><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 60pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl70 width=80></TD></TR><TR style="HEIGHT: 39pt" height=52><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; BACKGROUND-COLOR: #ffcc99; WIDTH: 48pt; HEIGHT: 39pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl67 height=52 width=64>EFG_XYZ </TD><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 60pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl70 width=80>Y/Exit code </TD></TR><TR style="HEIGHT: 39pt" height=52><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; BACKGROUND-COLOR: #ffcc99; WIDTH: 48pt; HEIGHT: 39pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl67 height=52 width=64>FGH_XYZ </TD><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 60pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl70 width=80>Y/Exit code </TD></TR><TR style="HEIGHT: 39pt" height=52><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; BACKGROUND-COLOR: #ffcc99; WIDTH: 48pt; HEIGHT: 39pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl67 height=52 width=64>GHI_XYZ </TD><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 60pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl70 width=80></TD></TR></TBODY></TABLE>
I basically need to find all the rows that have a "Y" or "Y/Exit code" in column B and delete/hide those rows temporarily because I'm going to run another piece of code that sums a bunch of values on sheet 1 based on matches made to the above department codes and pastes them on sheet 2 in column C next to their respective codes.
I don't need to return the values for the rows with the "Y"'s (though they do exist), hence the need for deleting them, but when I copy and paste all the values that will be in column C back to workbook 1, I need those rows back so the values match up with their original locations rather than being 5 or 10 rows short.
If I did a poor job explaining, please let me know and I'll provide more examples.
I appreciate any thoughts. Thanks.
I've got a macro set up that opens two workbooks, copies and pastes a column containing department codes from workbook 1 into workbook 2, sheet 2, like so:
<TABLE style="WIDTH: 108pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=144><COLGROUP><COL style="WIDTH: 48pt" width=64><COL style="WIDTH: 60pt; mso-width-source: userset; mso-width-alt: 2925" width=80><TBODY><TR style="HEIGHT: 39pt" height=52><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; BACKGROUND-COLOR: #ffcc99; WIDTH: 48pt; HEIGHT: 39pt; BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid" class=xl67 height=52 width=64>ABC_XYZ </TD><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 60pt; BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid" class=xl70 width=80></TD></TR><TR style="HEIGHT: 39pt" height=52><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; BACKGROUND-COLOR: #ffcc99; WIDTH: 48pt; HEIGHT: 39pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl67 height=52 width=64>BCD_XYZ</TD><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 60pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl70 width=80></TD></TR><TR style="HEIGHT: 39pt" height=52><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; BACKGROUND-COLOR: #ffcc99; WIDTH: 48pt; HEIGHT: 39pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl67 height=52 width=64>CDE_XYZ </TD><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 60pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl70 width=80>Y </TD></TR><TR style="HEIGHT: 39pt" height=52><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; BACKGROUND-COLOR: #ffcc99; WIDTH: 48pt; HEIGHT: 39pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl67 height=52 width=64>DEF_XYC </TD><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 60pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl70 width=80></TD></TR><TR style="HEIGHT: 39pt" height=52><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; BACKGROUND-COLOR: #ffcc99; WIDTH: 48pt; HEIGHT: 39pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl67 height=52 width=64>EFG_XYZ </TD><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 60pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl70 width=80>Y/Exit code </TD></TR><TR style="HEIGHT: 39pt" height=52><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; BACKGROUND-COLOR: #ffcc99; WIDTH: 48pt; HEIGHT: 39pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl67 height=52 width=64>FGH_XYZ </TD><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 60pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl70 width=80>Y/Exit code </TD></TR><TR style="HEIGHT: 39pt" height=52><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; BACKGROUND-COLOR: #ffcc99; WIDTH: 48pt; HEIGHT: 39pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl67 height=52 width=64>GHI_XYZ </TD><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 60pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 1pt solid" class=xl70 width=80></TD></TR></TBODY></TABLE>
I basically need to find all the rows that have a "Y" or "Y/Exit code" in column B and delete/hide those rows temporarily because I'm going to run another piece of code that sums a bunch of values on sheet 1 based on matches made to the above department codes and pastes them on sheet 2 in column C next to their respective codes.
I don't need to return the values for the rows with the "Y"'s (though they do exist), hence the need for deleting them, but when I copy and paste all the values that will be in column C back to workbook 1, I need those rows back so the values match up with their original locations rather than being 5 or 10 rows short.
If I did a poor job explaining, please let me know and I'll provide more examples.
I appreciate any thoughts. Thanks.