LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Dynamic color selection in charts


Hi,

I have an Excel macro that creates a chart with flexible number o
lines (usually up to three lines) and flexible number of points fo
each line (may reach 10 points per line). All points and all line
should be in different colors.
Does someone know of a way to set colors dynamically in a wide colo
range that has good distinction between each color?

I tried the following code but when I have many points some colors ar
very similar and some are even white.

" Select Case nLineIndex
Case 0:
Select Case nPointIndex
Case 1:
GetPointColor = 3
Case 2:
GetPointColor = 10
Case 3:
GetPointColor = 53
Case 4:
GetPointColor = 39
Case Else:
GetPointColor = nPointIndex* 14 + 1
End Select
Case 1:
Select Case nPointIndex
Case 1:
GetPointColor = 5
Case 2:
GetPointColor = 52
Case 3:
GetPointColor = 46
Case 4:
GetPointColor = 20
Case Else:
GetPointColor = nPointIndex* 10 + 2
End Select
Case 2:
Select Case nPointIndex
Case 1:
GetPointColor = 4
Case 2:
GetPointColor = 13
Case 3:
GetPointColor = 33
Case 4:
GetPointColor = 45
Case Else:
GetPointColor = nPointIndex* 20 + 3
End Select
Case Else:
GetPointColor = nPointIndex* nLineIndex* 10 + nLineIndex
End Select"

Thanks,

Ana

--
Ana
-----------------------------------------------------------------------
Anat's Profile: http://www.excelforum.com/member.php...fo&userid=1670
View this thread: http://www.excelforum.com/showthread.php?threadid=31926

 
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
Dynamic Range Selection Using VBA TEK Excel Discussion (Misc queries) 2 January 23rd 10 04:55 AM
Dynamic data selection for charts sudheera Charts and Charting in Excel 1 June 10th 08 09:08 AM
Make dynamic charts more dynamic Milo Charts and Charting in Excel 1 April 12th 06 09:01 AM
Dynamic Range Selection Todd Huttenstine Excel Programming 4 May 5th 04 08:54 PM
Dynamic Row Selection Bruce B[_2_] Excel Programming 4 July 14th 03 09:14 PM


All times are GMT +1. The time now is 04:59 PM.

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"