LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default code to mark coloured cells in excel

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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I add active tick mark/check mark boxes in excel? gerberelli Excel Discussion (Misc queries) 2 May 3rd 08 05:16 PM
Is there an Excel forumla to count different coloured cells? dataprincess Excel Discussion (Misc queries) 2 November 22nd 07 11:29 PM
Can Excel mark or identify duplicate cells in a range? Rob McEwan Excel Discussion (Misc queries) 0 February 15th 07 03:54 PM
code for hiding rows-(coloured) srinivasan Excel Programming 7 August 24th 05 11:26 AM
Is it possible to have a code that counts coloured cells? Fiona Excel Programming 4 February 14th 05 01:41 PM


All times are GMT +1. The time now is 04:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"