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: 3
Default Changing a cell color inside a function called by that cell

When I try to change the color of cell from a function called from that cell, the change never takes place.

function SetMyColor (colorindex)

Application.Caller.Interior.ColorIndex = colorindex 'this line never works


If Application.Caller.Interior.ColorIndex = xlNone Then
SetMyColor = "None"
Else
SetMyColor = Application.Caller.Interior.ColorIndex
End If
end function

I've tried any number of variations, including hardcoding the range, for example:

Range("J4").interior.ColorIndex = 17

and the color is never changed. I can change the color from a stand-along macro, just not from a function.

If I change the color manually, the function will return the colorIndex successfully.

Is this symptom part of a general issue of changing cells from within functions they call?

Is there a way around it?

Thanks!

---Wayne Erfling
 
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
How do I know which cell a function is called from? Murami Excel Worksheet Functions 3 November 24th 06 02:22 PM
From which cell is my VBA function called ? Helge V. Larsen Excel Programming 2 August 15th 06 01:28 PM
Need to know what cell called the custom VBA function? partyOfOne Excel Programming 1 September 19th 05 05:06 PM
Excel VBA-Changing cell color with if then function red5 Excel Programming 2 July 23rd 04 05:06 AM
How do I find which cell called a function? TL[_2_] Excel Programming 3 July 12th 03 02:12 AM


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