Sign in to follow this  
Followers 0
dazza

_excel udf. Getting the cell colour?

4 posts in this topic

Dear Boffins,

Is there anyway of getting a cell colour in a spreadsheet? The excel udfs only cover the basic. I hope so; I don't want to resort to VBAing the result--I'd like to keep everything AutoIT.

Ta

Share this post


Link to post
Share on other sites



One way is with the single cell selected, run:

$color = $oExcel.Selection.Interior.ColorIndex

I found a color table here.

For instance if my cell was highlighted yellow it would return a 6.

Sorry but I'm not sure if this is already built in to release UDFs or not

Share this post


Link to post
Share on other sites

Hmm. You have me perplexed MrMitchell...

$color = $headcount_excel.Selection.Interior.ColorIndex

This returns a value of 19. But...

1) The excel udfs do not cover this function (it matters not mind)

2) How do I select a specific cell?

If 2) can be answered then I'm a happy bunny.

Many thanks

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hmm. You have me perplexed MrMitchell...

$color = $headcount_excel.Selection.Interior.ColorIndex

This returns a value of 19. But...

1) The excel udfs do not cover this function (it matters not mind)

2) How do I select a specific cell?

If 2) can be answered then I'm a happy bunny.

Many thanks

Sorry for rewriting this post:

This works in excel macros:

Range("F14").Interior.ColorIndex = 6

Edit:

This lets you use rgb:

Range("F14").Interior.Color = RGB(0, 0, 255)
Edited by Mat

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0