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: 2
Default Coloring cells thru VBA

I was working on a function that calculates the average
value of a range of cells. If the average amounts to
zero, I want to change either the cell background to a
particular color to alert users. I tried this in VBA:

If Occupancy = 0 Then
ActiveCell.Interior.Color= RGB(255, 0, 0)
End If

Where Occupancy is the name of the function. However this
doesn't work as expected and the cell's color remains
unchanged. Yet the same command works perfectly through
the immediate window. Can anyone explain why it doesn't
work and how to rectify it? Thanks
 
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
coloring cells 6371 New Users to Excel 2 April 22nd 09 04:26 AM
coloring cells egarcia Excel Discussion (Misc queries) 0 November 29th 06 05:49 PM
COLORING IN CELLS jim mcgrath Excel Discussion (Misc queries) 4 November 24th 05 04:31 PM
Coloring certain cells Tim Excel Worksheet Functions 2 September 5th 05 04:01 AM
Coloring Cells Gabbi Excel Worksheet Functions 2 July 27th 05 09:54 PM


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