Hello,
I like to change the colorIndex of a cell by a function is it possible ?
The code following doesn't works:
Function Fncolor(Value)
Worksheets(quot;Sheetquot;).Cells(RowNbr, ColumnNbr).Font.ColorIndex = 3
Fncouleur = quot;nnnnnnquot;
End Function
With a cell containing '=Fncolor(5)' to call the function
The goal is to avoid Format / condition limitation to 3 conditions....
Thanks for your Help
Gilles P(FR)
The colorindex can not be changed by a function alone. You would need an
event macro to operate in conjunction with the function.
--
Gary's Studentquot;Gilles P (FR)quot; wrote:
gt; Hello,
gt;
gt; I like to change the colorIndex of a cell by a function is it possible ?
gt; The code following doesn't works:
gt;
gt; Function Fncolor(Value)
gt; Worksheets(quot;Sheetquot;).Cells(RowNbr, ColumnNbr).Font.ColorIndex = 3
gt; Fncouleur = quot;nnnnnnquot;
gt; End Function
gt;
gt; With a cell containing '=Fncolor(5)' to call the function
gt;
gt; The goal is to avoid Format / condition limitation to 3 conditions....
gt; Thanks for your Help
gt;
gt; Gilles P(FR)
gt;
gt;
So, to skip it i use these events to call the procedure
Sub Worksheet_Change(ByVal Target As Range)
macro Target 'Call a procedure to change
colorindex
End Sub
or
Sub Worksheet_SelectionChange (ByVal Target As Range)
macro Target 'Call a procedure to change
colorindex
End SubIs there no any other way ?
because the code will run on each change in worksheet.
Nota: To call an other procedure from function doesn't works too !!
Gilles P (FR)quot;Gary''s Studentquot; a écrit :
gt; The colorindex can not be changed by a function alone. You would need an
gt; event macro to operate in conjunction with the function.
gt; --
gt; Gary's Student
gt;
gt;
gt; quot;Gilles P (FR)quot; wrote:
gt;
gt; gt; Hello,
gt; gt;
gt; gt; I like to change the colorIndex of a cell by a function is it possible ?
gt; gt; The code following doesn't works:
gt; gt;
gt; gt; Function Fncolor(Value)
gt; gt; Worksheets(quot;Sheetquot;).Cells(RowNbr, ColumnNbr).Font.ColorIndex = 3
gt; gt; Fncouleur = quot;nnnnnnquot;
gt; gt; End Function
gt; gt;
gt; gt; With a cell containing '=Fncolor(5)' to call the function
gt; gt;
gt; gt; The goal is to avoid Format / condition limitation to 3 conditions....
gt; gt; Thanks for your Help
gt; gt;
gt; gt; Gilles P(FR)
gt; gt;
gt; gt;
- Mar 09 Fri 2007 20:36
Change Cell properties by Function
close
全站熱搜
留言列表
發表留言