Finish this sentence

S

scottnshelly

Application.Dialogs(xlDialogColorPalette).Show

this is awesome, but then it doesn't do anything when i chose my color
What are the possibilities
 
B

Bob Phillips

Hi Scott,

Here is one way to use it.

To demonstrate it , type ?ReturnColorindex() in the immediate window, and
you will be returned the number of the colour you choose.

Function ReturnColorindex() As Long
Dim rngCurr As Range
Set rngCurr = Selection
Application.ScreenUpdating = False
Range("IV1").Select
Application.Dialogs(xlDialogPatterns).Show
ReturnColorindex = ActiveCell.Interior.ColorIndex
ActiveCell.Interior.ColorIndex = xlColorIndexAutomatic
rngCurr.Select
End Function


Note, you cannot call this function as a UDF as it updates another cell in
the workbook.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
S

scottnshelly

Thanks Bob,
i'm afaid i don't know what you mean by 'immediate window'. Wher
exactly should i put ?ReturnColorIndex() ?
Thanks
 
B

Bob Phillips

Scott,

Normally you would just use this function to return a ColorIndex value, as
selected from the palette. What I was saying was that you could demonstrate
it by typing ?ReturnColorIndex() in the immediate window, so that you can
get used to using it and how it works. To get the immediate window, go to
the View menu in the VBE and click the Immediate Window option. Then just
type that code into the window.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top