Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default How to pass interior colours of specified range to a control.

Is is possible to load the interior colours of a range of cells into control?
That is I have a range A1:A5 -all of which have different interior cell
colours. I want to be able to pass these actual interiour colours (not their
interior colour numbers) to a control and choose them for search criteria.
So effectively, upon displaying the colours, I decide that I want the colour
of cell A1 (cell.InteriorColour = Yellow), and I search for other cells with
that colour.

I know I can also use the John Walkenbach colour palette and potentially
load it with the colours from this range and then turn the enable propertly
of the remaining buttons to FALSE if need be.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default How to pass interior colours of specified range to a control.

How about the color property, rather than the colorindex?

--
HTH

Bob Phillips

"ExcelMonkey" wrote in message
...
Is is possible to load the interior colours of a range of cells into

control?
That is I have a range A1:A5 -all of which have different interior cell
colours. I want to be able to pass these actual interiour colours (not

their
interior colour numbers) to a control and choose them for search criteria.
So effectively, upon displaying the colours, I decide that I want the

colour
of cell A1 (cell.InteriorColour = Yellow), and I search for other cells

with
that colour.

I know I can also use the John Walkenbach colour palette and potentially
load it with the colours from this range and then turn the enable

propertly
of the remaining buttons to FALSE if need be.

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to pass interior colours of specified range to a control.


Good afternoon Excel monkey

The code below will pass the colours from a selected range to a
variable (b) and then display these in a msgbox. The msgbox is just to
prove that it works.

Sub colours()
Dim UsrRnge, a(), b, c, d
b = Selection.Cells.Count
c = 1
ReDim a(b)
For Each UsrRnge In Selection
a(c) = UsrRnge.Interior.ColorIndex
c = c + 1
Next UsrRnge

For d = 1 To b
MsgBox a(d)
Next d
End Sub


This code could be streamlined, but I've left it as simple as possible
with individual steps to show exactly how it has been done.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=390149

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default How to pass interior colours of specified range to a control.

The OP will need the actual colour rather than the ColorIndex

colorVal = activeworbook.colors(cIndex)

Regards,
Peter T

"dominicb" wrote in
message ...

Good afternoon Excel monkey

The code below will pass the colours from a selected range to a
variable (b) and then display these in a msgbox. The msgbox is just to
prove that it works.

Sub colours()
Dim UsrRnge, a(), b, c, d
b = Selection.Cells.Count
c = 1
ReDim a(b)
For Each UsrRnge In Selection
a(c) = UsrRnge.Interior.ColorIndex
c = c + 1
Next UsrRnge

For d = 1 To b
MsgBox a(d)
Next d
End Sub


This code could be streamlined, but I've left it as simple as possible
with individual steps to show exactly how it has been done.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile:

http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=390149



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to pass interior colours of specified range to a control.

Sounded more to me like he wanted names like Pink, Yellow and Blue. But who
knows.
--
Regards,
Tom Ogilvy

"Peter T" <peter_t@discussions wrote in message
...
The OP will need the actual colour rather than the ColorIndex

colorVal = activeworbook.colors(cIndex)

Regards,
Peter T

"dominicb" wrote

in
message ...

Good afternoon Excel monkey

The code below will pass the colours from a selected range to a
variable (b) and then display these in a msgbox. The msgbox is just to
prove that it works.

Sub colours()
Dim UsrRnge, a(), b, c, d
b = Selection.Cells.Count
c = 1
ReDim a(b)
For Each UsrRnge In Selection
a(c) = UsrRnge.Interior.ColorIndex
c = c + 1
Next UsrRnge

For d = 1 To b
MsgBox a(d)
Next d
End Sub


This code could be streamlined, but I've left it as simple as possible
with individual steps to show exactly how it has been done.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile:

http://www.excelforum.com/member.php...o&userid=18932
View this thread:

http://www.excelforum.com/showthread...hreadid=390149







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default How to pass interior colours of specified range to a control.

Sounded more to me like he wanted names like Pink, Yellow and Blue. But
who
knows.


You might be right, but it looks like we are not destined to know either
way.

Regards,
Peter T


"Peter T" <peter_t@discussions wrote in message
...
The OP will need the actual colour rather than the ColorIndex

colorVal = activeworbook.colors(cIndex)

Regards,
Peter T

"dominicb" wrote

in
message ...

Good afternoon Excel monkey

The code below will pass the colours from a selected range to a
variable (b) and then display these in a msgbox. The msgbox is just

to
prove that it works.

Sub colours()
Dim UsrRnge, a(), b, c, d
b = Selection.Cells.Count
c = 1
ReDim a(b)
For Each UsrRnge In Selection
a(c) = UsrRnge.Interior.ColorIndex
c = c + 1
Next UsrRnge

For d = 1 To b
MsgBox a(d)
Next d
End Sub


This code could be streamlined, but I've left it as simple as possible
with individual steps to show exactly how it has been done.

HTH

DominicB


--
dominicb


------------------------------------------------------------------------
dominicb's Profile:

http://www.excelforum.com/member.php...o&userid=18932
View this thread:

http://www.excelforum.com/showthread...hreadid=390149







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
Pass control back to Excel window [email protected] Excel Worksheet Functions 1 December 29th 06 07:24 PM
color the interior of a range Pierre via OfficeKB.com Excel Worksheet Functions 1 November 2nd 05 12:55 PM
How to Pass Control from VBA to user and return needyourhelp Excel Programming 3 June 7th 05 12:53 PM
Clearing Interior Colours or all sheets ExcelMonkey[_190_] Excel Programming 4 March 22nd 05 10:39 PM
Select All Sheets and clear Interior Cell colours Gord Dibben Excel Programming 0 March 21st 05 11:28 PM


All times are GMT +1. The time now is 05:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"