Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Q: UDF with Interior.colorindex Help needed

Hi
I wrote a short function "interior"

Function interior(Rng) As Integer
Application.Volatile True
interior = Rng.interior.ColorIndex
End Function

And that works if I call a function with for instance =interior(c3) an i got
color index of cell c3
but I need color index of cell that contains the function ,
something like if in C3 I put =row() I will got 3

How to do this?

Thank you for reading this especially if you are able to help me out on
this.
Maxx

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Q: UDF with Interior.colorindex Help needed

Function MyInterior(Optional Rng As Range) As Integer

Application.Volatile

If Rng Is Nothing Then
'This line must be in single line
MyInterior = Application.ThisCell.Interior.ColorIndex
Else
'This line must be in single line
MyInterior = Rng.Interior.ColorIndex
End If

End Function

Pls confirm
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Q: UDF with Interior.colorindex Help needed

Function MyInterior(Optional Rng As Range) As Integer

Application.Volatile

If Rng Is Nothing Then
MyInterior = Application.ThisCell.interior.ColorIndex
Else
MyInterior = Rng.interior.ColorIndex
End If

End Function
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default UDF with Interior.colorindex Help needed

This is exactly what I was looking for
Thanks a lot!!!

"Javed" wrote in message
...

Function MyInterior(Optional Rng As Range) As Integer

Application.Volatile

If Rng Is Nothing Then
MyInterior = Application.ThisCell.interior.ColorIndex
Else
MyInterior = Rng.interior.ColorIndex
End If

End Function

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Q: UDF with Interior.colorindex Help needed

I could use this too :-)

But, is it possible to 'expand' the function a little?

If you given a range of cells, i.e. =MyInterior(H3:J11), could the function
be made so it take the color of the first cell in the range?


TIA...


"Javed" wrote in message
...
Function MyInterior(Optional Rng As Range) As Integer

Application.Volatile

If Rng Is Nothing Then
MyInterior = Application.ThisCell.interior.ColorIndex
Else
MyInterior = Rng.interior.ColorIndex
End If

End Function





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 420
Default Q: UDF with Interior.colorindex Help needed

Option Explicit
Function MyInterior(Optional Rng As Range) As Long

Application.Volatile

If Rng Is Nothing Then
MyInterior = Application.Caller.Interior.ColorIndex
Else
MyInterior = Rng.Cells(1).Interior.ColorIndex
End If

End Function



On 06/19/2011 05:57, Charlotte E wrote:
I could use this too :-)

But, is it possible to 'expand' the function a little?

If you given a range of cells, i.e. =MyInterior(H3:J11), could the function
be made so it take the color of the first cell in the range?


TIA...


wrote in message
...
Function MyInterior(Optional Rng As Range) As Integer

Application.Volatile

If Rng Is Nothing Then
MyInterior = Application.ThisCell.interior.ColorIndex
Else
MyInterior = Rng.interior.ColorIndex
End If

End Function




--
Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Q: UDF with Interior.colorindex Help needed

Thanks :-)


"Dave Peterson" wrote in message
...
Option Explicit
Function MyInterior(Optional Rng As Range) As Long

Application.Volatile

If Rng Is Nothing Then
MyInterior = Application.Caller.Interior.ColorIndex
Else
MyInterior = Rng.Cells(1).Interior.ColorIndex
End If

End Function



On 06/19/2011 05:57, Charlotte E wrote:
I could use this too :-)

But, is it possible to 'expand' the function a little?

If you given a range of cells, i.e. =MyInterior(H3:J11), could the
function
be made so it take the color of the first cell in the range?


TIA...


wrote in message
...
Function MyInterior(Optional Rng As Range) As Integer

Application.Volatile

If Rng Is Nothing Then
MyInterior = Application.ThisCell.interior.ColorIndex
Else
MyInterior = Rng.interior.ColorIndex
End If

End Function




--
Dave Peterson



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
Cells(row, j).Interior.colorindex KT_1010 Excel Programming 3 August 5th 10 05:34 PM
more on interior.colorindex issue bst Excel Programming 4 July 2nd 08 05:43 PM
interior.colorindex does not work? bst Excel Programming 11 June 28th 08 02:05 PM
Use of Interior.ColorIndex liquidhot Excel Programming 4 June 27th 05 07:22 PM
Testing for Interior.ColorIndex JeffBo Excel Programming 7 May 17th 04 09:41 PM


All times are GMT +1. The time now is 10:21 AM.

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"