View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ardus Petus Ardus Petus is offline
external usenet poster
 
Posts: 718
Default Color contents of a cell accessed by a function?

A function can only return a result.
Outside very few exceptions, it cannot alter the look or contents of another
cell.

HTH
--
AP

"James Cornthwaite" a écrit dans le
message de news: ...
Ideally i would like to color the contents of the cell accessed by the
call of my function "findnewnominal(...)" The reason for this is the
function is called many times on a range table range and I would like to
know at a glance which rows in the table hadn't yet been accessed by a
calls of the function.

My macro to date (which works fine is)


Function FindOldNominal(NomCode, definedRange)

FindOldNominal = Worksheetfunction.VLookup(NomCode, definedRange, 5,
false)
EndFunction





but if i want to color the cell accessed I imagine i have to use something
like the following? (my attempt of something pseudocode)


Function FindOldNominal(NomCode, definedRange)

Activecell = reference(Worksheetfunction.VLookup(NomCode, definedRange, 5,
false))
Activecell.Interior.ColorIndex = 3 (i.e red etc)

FindOldNominal = Worksheetfunction.VLookup(NomCode, definedRange, 5,
false)
EndFunction


I appreciate the above is probably non sensical but know little about
excel functions and just wanted to make as clear as possible what i wanted
to do.
Any help would be greatly appreciated.

Thanks
James