Bearcat Brew
New Member
- Joined
- Dec 7, 2004
- Messages
- 40
I have a list of RGB color coordinates - red value is in column B, green value in column C, and blue value in column D. Their are 240 sets of coordinates and from top to bottom, it should create a smooth color gradient from pale yellow (249, 248, 206) to dark brown (38, 23, 22). I ran this macro to get column A to represent the color from columns B, C, D:
The result was not a smooth color palette, but a dozen or two cells the same color followed by another dozen or two of a darker color, repeating to row 240.
Questions:
-Why doesn't this work?
-I have now started doing this in MS Paint by hand. I go to the Edit Colors..., and create a custom color with one set of RGB values, then draw a vertical line about 20 pixels high by 1 pixel wide. I repeat for the next set of values and place the line next to the last one. This makes it look correct, but it is incredibly tedious. Is there a way to automate this from the table in Excel to draw lines in Paint?
Code:
Sub Palette()
RowNum = 1
For RowNum = 1 To 240
RedVal = Cells(RowNum, 2).Value
GreenVal = Cells(RowNum, 3).Value
BlueVal = Cells(RowNum, 4).Value
Cells(RowNum, 1).Interior.Color = RGB(RedVal, GreenVal, BlueVal)
Next
End Sub
The result was not a smooth color palette, but a dozen or two cells the same color followed by another dozen or two of a darker color, repeating to row 240.
Questions:
-Why doesn't this work?
-I have now started doing this in MS Paint by hand. I go to the Edit Colors..., and create a custom color with one set of RGB values, then draw a vertical line about 20 pixels high by 1 pixel wide. I repeat for the next set of values and place the line next to the last one. This makes it look correct, but it is incredibly tedious. Is there a way to automate this from the table in Excel to draw lines in Paint?