Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...