I need something that is to the purpose of:
if the cell is highlighted, copy the row and paste it here.
What is the code for testing whether a cell or row is highlighted?
Public Function CountSpecial(ColorCell As Range, CntRng As Range) As
Long
'This function will count the contents of cells within the CNTRNG
argument that are highlighted and
'NOT HIDDEN with the same background color as that contained
within the COLORCELL range argument.
On Error GoTo CSErrHandler
Dim CurCell As Range
Dim CurColor As Long
CurColor = ColorCell.Interior.ColorIndex
'MsgBox "The current color selected is " &
ColorCell.Interior.ColorIndex
For Each CurCell In CntRng
'check to see if the row is hidden, if it is then skip to
the next cell
If CurCell.EntireRow.Hidden = False Then
If CurCell.Interior.ColorIndex = CurColor Then
CountSpecial = CountSpecial + CurCell
************************************************************************************************
'YOU WOULD ENTER YOUR COPY & PASTE ROUTINE HERE.
************************************************************************************************
End If
End If
Next CurCell
Exit Function
CSErrHandler:
End Function
This will not do all that you are asking, but it will enable you to
identify cells that are highlighted.
Hope that gets you going in the right direction.
Mark