D
David Kennedy
Hi,
I have an excel file that has 17000 rows and 33 cols.
Some of the cells in the file are highlighted yellow.
I am trying to mark (with an X) in col 34 at the end what rows contains the
highlighted cell
My code below:
Dim rngCells As Range
Dim intRows As Long
Dim intFields As Long
Dim iRow As Long
Dim iField As Long
Set rngCells = Application.ActiveWorkbook.ActiveSheet.UsedRange
intRows = rngCells.Rows.Count
intFields = rngCells.Columns.Count
For iRow = 1 To intRows Step 2
For iField = 1 To intFields
If Cells(iRow, iField).ColorIndex.Value = 6 Then
With Cells(iRow, 34)
.Value = "X"
End With
End If
Next iField
Next iRow
Set rngCells = Nothing
MsgBox "Yellow colors flagged"
The code gives me an error on the first If saying "Object doesnt support
this property or method"
Can anyone help? or is my code completely wrong?
Thanks in advance
David
I have an excel file that has 17000 rows and 33 cols.
Some of the cells in the file are highlighted yellow.
I am trying to mark (with an X) in col 34 at the end what rows contains the
highlighted cell
My code below:
Dim rngCells As Range
Dim intRows As Long
Dim intFields As Long
Dim iRow As Long
Dim iField As Long
Set rngCells = Application.ActiveWorkbook.ActiveSheet.UsedRange
intRows = rngCells.Rows.Count
intFields = rngCells.Columns.Count
For iRow = 1 To intRows Step 2
For iField = 1 To intFields
If Cells(iRow, iField).ColorIndex.Value = 6 Then
With Cells(iRow, 34)
.Value = "X"
End With
End If
Next iField
Next iRow
Set rngCells = Nothing
MsgBox "Yellow colors flagged"
The code gives me an error on the first If saying "Object doesnt support
this property or method"
Can anyone help? or is my code completely wrong?
Thanks in advance
David