Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Use of Interior.ColorIndex


I'm attempting to color an excel spreadsheet every other row, withou
affecting cells that already have a color in them other than values 3
and 20.

However, I'm not sure I'm correctly using the ColorIndex properly an
currently my code doesn't color anything.

Can anyone see why?


Code
-------------------
Sub ColorRows()
'//This subroutine ignores cells colored something other than 37 and 20.
Dim Row As Range 'The Current row
Dim OrderRange As Range 'The Project number column
Dim Cell As Range
Dim RowCell As Range
Dim Color As Boolean 'Alternating Color
Dim CountCell As Integer 'Current project number

Set OrderRange = Range("A14", "A500")
Color = True
CountCell = 1

For Each Cell In OrderRange
If Cell.Value = CountCell Then 'see if it's in order
Set Row = Range(Cell, "EE" & Cell.Row) 'Select row out to column EE

For Each RowCell In Row
Select Case RowCell.Interior.ColorIndex
Case 37
If Color Then
RowCell.Interior.ColorIndex = 37 'Darkerblue color
Else
RowCell.Interior.ColorIndex = 20 'lighterblue color
End If
Case 20
If Color Then
RowCell.Interior.ColorIndex = 37 'Darkerblue color
Else
RowCell.Interior.ColorIndex = 20 'lighterblue color
End If
Case Else
'Do nothing
End Select
Next
If Color Then
Color = False
Else
Color = True
End If

CountCell = CountCell + 1
ElseIf Cell.Value = "" Then 'see if count should be reset
CountCell = 1
Color = True
End If
Next

Call Develop_GANTT

End Su
-------------------

--
liquidho
-----------------------------------------------------------------------
liquidhot's Profile: http://www.excelforum.com/member.php...fo&userid=2467
View this thread: http://www.excelforum.com/showthread.php?threadid=38247

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Use of Interior.ColorIndex


Code
-------------------
Select Case RowCell.Interior.ColorInde
-------------------


This is the line I think the problem is on... but I can't be sure

--
liquidho
-----------------------------------------------------------------------
liquidhot's Profile: http://www.excelforum.com/member.php...fo&userid=2467
View this thread: http://www.excelforum.com/showthread.php?threadid=38247

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Use of Interior.ColorIndex


Does anyone know

--
liquidho
-----------------------------------------------------------------------
liquidhot's Profile: http://www.excelforum.com/member.php...fo&userid=2467
View this thread: http://www.excelforum.com/showthread.php?threadid=38247

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Use of Interior.ColorIndex

Your code worked fine for me or at least it worked as I expected it to work.
If A14 doesn't contain 1 and progress by 1 in subsequent rows, then your
code won't pass the very first test and will do nothing.

--
Regards,
Tom Ogilvy



"liquidhot" wrote
in message ...

Does anyone know?


--
liquidhot
------------------------------------------------------------------------
liquidhot's Profile:

http://www.excelforum.com/member.php...o&userid=24674
View this thread: http://www.excelforum.com/showthread...hreadid=382475



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Use of Interior.ColorIndex


I just figured it out! I was using color 34 in my Excel sheet! (Which is
very close to color 20).

Fixed!


--
liquidhot
------------------------------------------------------------------------
liquidhot's Profile: http://www.excelforum.com/member.php...o&userid=24674
View this thread: http://www.excelforum.com/showthread...hreadid=382475

Reply
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
Finding last occurence of Interior.ColorIndex 36 Linda New Users to Excel 2 May 28th 10 07:04 AM
Sumif interior.colorindex condition John Excel Worksheet Functions 7 June 1st 06 01:17 AM
conditional formatting and interior.colorindex Wazooli Excel Programming 1 February 24th 05 05:53 PM
VBA syntax for Font & Interior ColorIndex Dennis Excel Discussion (Misc queries) 1 November 25th 04 07:38 PM
Testing for Interior.ColorIndex JeffBo Excel Programming 7 May 17th 04 09:41 PM


All times are GMT +1. The time now is 10:54 AM.

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"