This should be an easy request, but I can't seem to find out how to do it
I am writing code to colour the background of a cell based on the RGB values held in other cells. So, for example, I have a list of Hex & RGB values for the colours I want to use (this is just a subset):
000000 0 0 0
121212 18 18 18
151515 21 21 21
161616 22 22 22
1b1b19 27 27 25
1e1e1e 30 30 30
Now, in my BasicMaker code, I would like to be able to use the above table to set the background colour of a particular cell based on certain logic (assume for the moment that it's simply going down the list and colouring a cell in the same row).
This is the code I have so far (ignore any superfluous vars as I always dim more than I need when I start a new program) which doesn't work:
Code: Select all
Option Explicit sub mysub() dim pm as Object dim oSheets, oSheet, oCellByPosition dim x, y, z, z1, a, b, c, d as integer dim aa, bb, cc, dd, ee, ff, gg, hh, tmp, dt, ctor, pub as string Set pm = CreateObject("PlanMaker.Application") pm.Application.Visible = True pm.Activate y = 0 b = 0 d = 2 for x = 1 to 44 aa = "b" & x bb = "c" & x cc = "d" & x dd = "f" & x ee = "h" & x a = 0 b = 0 c = 0 a = pm.Application.ActiveSheet.Range(aa).value b = pm.Application.ActiveSheet.Range(bb).value c = pm.Application.ActiveSheet.Range(cc).value d = pm.Application.ActiveSheet.Range(ee).value2 pm.Application.ActiveSheet.Range(dd).Shading.BackgroundPatternColor = d next x end sub
"BGR" value (Blue-Green-Red triplet). You can either indicate an arbitrary value or use one of the pre-defined BGR color constants.
but never actually seems to explain how to "indicate an arbitrary value"!
Any help would be greatly appreciated.
Thanks in advance