Copy function with using criteria
Private Sub CommandButton1_Click()
Dim rng as Range
set rng = cells(activeCell.Row,"E")
do
if rng.Font.ColorIndex = 3 then
rng.EntireRow.copy Destination:= _
Worksheets("Sheet2").Cells(rows.count,1).End(xlup)
exit do
end if
set rng = rng.offset(1,0)
Loop Until isempty(rng)
msgbox "No row meeting conditions was found"
End Sub
--
Regards,
Tom Ogilvy
"Jeff at Robert Bosch Corp." <Jeff at Robert Bosch
wrote in message
...
Hi,
I am trying to create a macro that will, when a command button is clicked,
copy a row and format it the same from one sheet to another if the color
of
the font in one of the cells of that row, let's say column E, is red or
yellow.
Also, if it doesn't copy one row, I would like it to paste the next row
fitting the above font color conditions on the line right below in the new
sheet.
|