Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
User Journal

Journal pocra's Journal: "Well... I'm back." 1

Afraid I've been distracted from /. for quite a while, and have just returned to find a comment from you on my last journal entry - now archived and un-add-to-able, hence this new entry for my (horribly boring) reply. Anyway, the changing-cell-colour-to-a-grey-scale-value-roughly-equivalent-to-the-cell's-numerical-value-in-relation-to-the-min-and-max-of-the-range macro did originally have a purpose when it was written, which was to try to help my PHB visualise trends in data where there was time-of-day in fifteen minute increments in one direction, and date (from 1 Jan->31 Dec) in the other direction, and the built-in charts all looked horribly cluttered (the surface ones weren't quite suitable, as the data could be quite "bumpy", making parts of the surface end up behind other parts of the surface, no matter which way you tried to turn it. (The greyscale has since been replaced with an absolutely hideous palette going from blue via red to white). The macro as it stands here is of course the "first draft", written without editing or pre-planning, hence the atrociousness of it (no dims, no error-trapping, it just dies horribly if there're any cells with text in them in the range).

With reasonably "smooth" data (or any brightly coloured worksheet) the following is sort-of-fun-and-annoying at the same time (if your machine doesn't flicker too much when changing the palette in Excel)...

sub cyclecolor
dim RuGBy(3)
while god=dead
for palno=1 To 24
unseperated=activeworkbook.colors(palno)
rugby(1)=unseperated-(256*int(unseperated/256))
rugby(2)=int(unseperated/(256^2))
rugby(3)=(unseperated-rugby(1)-(rugby(2)*(256^2)))/256
for prim=1 to 3
rugby(prim)=rugby(prim)-(((rugby(prim) mod 2)-0.5)*16)
if abs(rugby(prim)-127.5)>127.5 then rugby(prim)=rugby(prim)-(((rugby(prim) mod 2)-0.5)*18)
next
activeworkbook.colors(palno)=RGB(rugby(1),rugby(2),rugby(3))
next
wend
end sub

This discussion has been archived. No new comments can be posted.

"Well... I'm back."

Comments Filter:
  • Curses... something nasty happened yesterday, and somehow I submitted the parent before checking it over for sense... should have said that the colour-shifting macro is sort of fun and annoying when run after running the previous grey-shaded thing... ah there was a bunch more, but I'd better be getting on with me work rather than /.ing for another while (though I will say the colour-shifting thing is written terribly as a result of my just re-writing it straight into my journal; the original was written to demonstrate to a friend how to write a math-based macro without using any digits, making it horribly obfuscated (and just in case the variable names aren't obvious enough, RuGBy(1), RuGby(2), RuGBy(3) = Red, Green, Blue values, palno = palette number and prim = primary colour. also, God = Dead.

A morsel of genuine history is a thing so rare as to be always valuable. -- Thomas Jefferson

Working...