Prev: Multiple reference locking/unlockng in formulas
Next: How to limit number of Message Boxes on Validation Error?
From: Peter T on 26 Apr 2010 12:49 Joel, that doesn't help make same-shade colours light to dark. As I mentioned, need RGB to HSL to RGB with 20 increments of L but not near 0 or 1 Regards, Peter T "joel" <joel.4a1bb7(a)thecodecage.com> wrote in message news:joel.4a1bb7(a)thecodecage.com... > > Pick 20 different shade in the macro. Don't use colorindex, instead > select more colors. Convert the shades to hexidecimal to help you get > the inbetween shades > > > MyColor = 10053375 > RedShade = int(MyColor/(256*256)) > GreenShade = int(MyColor/256) mod 256 > BlueShade = MyColor Mod 256 > > > -- > joel > ------------------------------------------------------------------------ > joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229 > View this thread: > http://www.thecodecage.com/forumz/showthread.php?t=198482 > > http://www.thecodecage.com/forumz >
From: Rick Rothstein on 26 Apr 2010 12:52 Instead of recording a macro to get your colors, try doing this instead. Go into the VB editor (of a new workbook if you want) and add a UserForm. In the Properties box, select any property that allows color to be set (for example, the BackColor property), then click the down arrow that appear. Next, select the Palette tab on the dialog box that appears and right click one of the 16 white squares at the bottom of the dialog page. This will bring up a color selection panel. You can select the main color you want from the large color selection square and then select the 20 color intensities you want from the thin vertical bar to the right of it. As you select each color intensity, jot down the Red, Green and Blue values for it and then use the 20 jotted down Red, Green and Blue values in VB's RGB function when assigning them. -- Rick (MVP - Excel) "Paul W Smith" <pws(a)NOSPAM.twelve.me.uk> wrote in message news:uHPu1xV5KHA.4644(a)TK2MSFTNGP02.phx.gbl... > Thanks Joel. > > I too record macros to get color numbers. > > However in this instance I can use this meethod to determine to number for > the darkest color, but how do I find the number of the next shade.... with > the shades graduating on a scale of 1 to 20 with 1 being the darkest and > 20 being the lightest? > > > > "joel" <joel.4a17yc(a)thecodecage.com> wrote in message > news:joel.4a17yc(a)thecodecage.com... >> >> I usually record a macro and then maually select the colors I want. >> Then use the color numbers from the recorded macro in my code. the >> color numbers is a hexidecimal number which is in three parts (Red=0 to >> 255, Green=0 to 255, Blue=0 to 255). >> >> >> So you could uses >> >> Red = 25 >> Green = 50 >> Blue = 10 >> >> >> Mycolor = (Red*256*256) + (Green*256) + Blue >> >> >> -- >> joel >> ------------------------------------------------------------------------ >> joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229 >> View this thread: >> http://www.thecodecage.com/forumz/showthread.php?t=198482 >> >> http://www.thecodecage.com/forumz >> >> > >
From: joel on 26 Apr 2010 18:25 I tried to get a even spread of colors. I don't have a great graphics card so I getting with the macro very little spread. Yo may get better results Sub Macro2() Range("a1").Interior.Color = RGB(204, 0, 200) Range("A2").Interior.Color = RGB(204, 0, 190) Range("a3").Interior.Color = RGB(204, 0, 180) Range("a4").Interior.Color = RGB(204, 0, 170) Range("a5").Interior.Color = RGB(204, 0, 160) Range("a6").Interior.Color = RGB(204, 0, 150) Range("a7").Interior.Color = RGB(204, 0, 140) Range("a8").Interior.Color = RGB(204, 0, 130) Range("a9").Interior.Color = RGB(204, 0, 120) Range("a10").Interior.Color = RGB(204, 0, 110) Range("a11").Interior.Color = RGB(204, 0, 100) Range("a12").Interior.Color = RGB(204, 0, 90) Range("a13").Interior.Color = RGB(204, 0, 80) Range("a14").Interior.Color = RGB(204, 0, 70) Range("a15").Interior.Color = RGB(204, 0, 60) Range("a16").Interior.Color = RGB(204, 0, 50) Range("a17").Interior.Color = RGB(204, 0, 40) Range("a18").Interior.Color = RGB(204, 0, 30) Range("a19").Interior.Color = RGB(204, 0, 20) Range("a20").Interior.Color = RGB(204, 0, 10) End Sub -- joel ------------------------------------------------------------------------ joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229 View this thread: http://www.thecodecage.com/forumz/showthread.php?t=198482 http://www.thecodecage.com/forumz
From: joel on 28 Apr 2010 08:48 MyColor = 8210719 RedShade = int(MyColor/(256*256)) GreenShade = int(MyColor/256) mod 256 BlueShade = MyColor Mod 256 RGB(RedShade,GreenShade,BlueShade) -- joel ------------------------------------------------------------------------ joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229 View this thread: http://www.thecodecage.com/forumz/showthread.php?t=198482 http://www.thecodecage.com/forumz
From: Paul W Smith on 28 Apr 2010 09:08 How does this help me? I need something that I can use to color a control background at run time, so it has to be in the format similar to: &H80000005& You method below turns a Long number into RGB, but I already have RGB, I need the...whatveer the definiton is for the thing that has & signs at each end. "joel" <joel.4a4py8(a)thecodecage.com> wrote in message news:joel.4a4py8(a)thecodecage.com... > > MyColor = 8210719 > RedShade = int(MyColor/(256*256)) > GreenShade = int(MyColor/256) mod 256 > BlueShade = MyColor Mod 256 > > RGB(RedShade,GreenShade,BlueShade) > > > -- > joel > ------------------------------------------------------------------------ > joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229 > View this thread: > http://www.thecodecage.com/forumz/showthread.php?t=198482 > > http://www.thecodecage.com/forumz > >
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Multiple reference locking/unlockng in formulas Next: How to limit number of Message Boxes on Validation Error? |