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: 1
Default Setting ActiveCell color

I've a simple function, copied from various examples on the net, to sum
numbers based on the color of another cell. I want change the active cell
color but it doesn't seem to work. Any suggestions, any help appreciated,
code is as follows...

Function ColorSum(cRefColor, rRange)
Dim r As Range
Dim iColorIndex As Integer

ColorSum = 0

iColorIndex = cRefColor.Font.ColorIndex

'build formula for range
For Each C1 In rRange.Cells
If C1.Font.ColorIndex = iColorIndex Then
ColorSum = ColorSum + C1.Value
Else
C1.Font.ColorIndex = iColorIndex
End If
Next

'this doesn't work!
ActiveCell.Font.ColorIndex = iColorIndex

End Function




 
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
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
Cell background color (interior color) setting not working Martin E. Excel Programming 1 May 21st 06 07:00 PM
Setting Background Color RGB (Always goes to closest index color) [email protected] Excel Programming 6 December 2nd 05 11:47 PM
setting range from activecell in macro Giz Excel Programming 1 March 11th 05 05:16 PM
activecell color alldreams Excel Programming 8 April 1st 04 12:29 PM


All times are GMT +1. The time now is 07:24 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"