textbox backgroundcolor

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

for my application i created a form with a textbox on it. With a code the
value of the searched cell will be displayed in the textbox. However i also
want the textbox.backgroundcolor to be the same as the cell color. So
something like TextBox1.backgroundcolor = ActiveCell.interior.Colorindex.

Problem is that excel uses the colorindex 3 for the color red, and visual
basic uses &H000000FF& for that same color. Is there a way so that i can
create this?
 
TextBox1.BackColor = ActiveCell.Interior.Color

In passing -
myColorIndex = 3
myLongRGB = ActiveWorkbook.Colors(myColorIndex)

Regards,
Peter T
 
Use color instead of colorindex. the code below returns 255 for the variable
a.

Range("A1").Interior.ColorIndex = 3
a = Range("A1").Interior.Color
 
Thnx, it works great!

Joel said:
Use color instead of colorindex. the code below returns 255 for the variable
a.

Range("A1").Interior.ColorIndex = 3
a = Range("A1").Interior.Color
 

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

Back
Top