Filter by color
"Pawan" wrote:
I have a large spreadsheet. Many of the cells are highlighted with different
colors. I want to filter the database according to color like select the
cells with red background color only.
Is it possible?
In place filtering can be a bit complex to achieve, an easier way is to copy
the values to another worksheet. For example if you have two columns of data
and you want to extract the rows where cells in col 2 have red background
color.
Private Sub CommandButton1_Click()
Dim j As Integer, row As Integer
row = 1
For j = 1 To 100
If Cells(j, 2).Interior.Color = vbRed Then
Worksheets("Sheet2").Cells(row, 1).Formula = Cells(j, 1).Formula
Worksheets("Sheet2").Cells(row, 2).Formula = Cells(j, 2).Formula
row = row + 1
End If
Next j
End Sub
|