Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jason R Morris
 
Posts: n/a
Default how do I change the fill collor os a cell using a function in VB

I am trying to us an if then statment in a function to change the fill color
of a cell if the conditions are true. I have tried
"ActiveCell.Interior.ColorIndex = 6" that works in subs, but it does not
works in functions.
  #2   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default how do I change the fill collor os a cell using a function in VB

Hi Jason,

A user defined function (UDF) returns a value; it cannot change formatting
or alter its environment


---
Regards,
Norman



"Jason R Morris" wrote in message
...
I am trying to us an if then statment in a function to change the fill
color
of a cell if the conditions are true. I have tried
"ActiveCell.Interior.ColorIndex = 6" that works in subs, but it does not
works in functions.



  #3   Report Post  
Posted to microsoft.public.excel.misc
BekkiM
 
Posts: n/a
Default how do I change the fill collor os a cell using a function in VB

Why not just use conditional formatting? You can set up essentially the same
If/then conditions and get your fill color that way.

"Jason R Morris" wrote:

I am trying to us an if then statment in a function to change the fill color
of a cell if the conditions are true. I have tried
"ActiveCell.Interior.ColorIndex = 6" that works in subs, but it does not
works in functions.

  #4   Report Post  
Posted to microsoft.public.excel.misc
David McRitchie
 
Posts: n/a
Default how do I change the fill collor os a cell using a function in VB

see Conditional Formatting
http://www.mvps.org/dmcritchie/excel/condfmt.htm
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"BekkiM" wrote...
Why not just use conditional formatting? You can set up essentially the same
If/then conditions and get your fill color that way.

"Jason R Morris" wrote:
I am trying to us an if then statment in a function to change the fill color
of a cell if the conditions are true. I have tried
"ActiveCell.Interior.ColorIndex = 6" that works in subs, but it does not
works in functions.



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
Using logic to change the fill in a cell JohnHaslam Excel Discussion (Misc queries) 3 December 19th 05 12:33 PM
change cell shading whenever contents different from previous cell zooeyhallne Excel Discussion (Misc queries) 3 June 6th 05 09:59 PM
Function syntax to compare cell contents ES Excel Worksheet Functions 2 May 18th 05 03:53 PM
Hyperlinks using R[1]C[1] and offset function in its cell referenc Elijah-Dadda Excel Worksheet Functions 0 March 5th 05 03:31 AM
Identifying the Active Fill Color Steve Conary Excel Discussion (Misc queries) 3 December 9th 04 04:45 AM


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

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

About Us

"It's about Microsoft Excel"