+ Reply to Thread
Results 1 to 4 of 4

how do I change the fill collor os a cell using a function in VB

  1. #1
    Jason R Morris
    Guest

    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. #2
    Norman Jones
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    >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. #3
    BekkiM
    Guest

    RE: 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. #4
    David McRitchie
    Guest

    Re: 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" <[email protected]> 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1