Color in Visual Basic

Joined
Jun 11, 2011
Messages
14
Reaction score
2
Here's an excerpt from a macro I recorded to try to dope out the color code:
.Color = 7260360
This is R=200,G=200,B=110
or Hex c8c86e
How can I translate from RGB or Hex to VB? (or back)
 
Joined
Dec 28, 2017
Messages
8
Reaction score
1
Try this
Sub Test()
Dim LR as long
LR= Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To LR
R = Cells(i, 1).Value
G = Cells(i, 2).Value
B = Cells(i, 3).Value
Cells(i, 4).Interior.Color =RGB(R,G,B)
Next i
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top