ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Keep text color (https://www.excelbanter.com/excel-programming/365605-keep-text-color.html)

LookingGood

Keep text color
 
Hi All,

How can I get a Userform textbox to display the different color text in a
cell it references.

Thank you



Chip Pearson

Keep text color
 
You're writing skills are not very clear. It isn't clear whether
the text box should take the color of the cell or the cell should
take the color of the text box.
If you want the text box to take the color of a cell, use

Private Sub UserForm_Initialize()
Me.TextBox1.BackColor = Range("A1").Interior.Color
End Sub

If you want the cell to take the color of the text box, use

Range("A1").Interior.Color = Me.TextBox1.BackColor


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"LookingGood" wrote in
message
...
Hi All,

How can I get a Userform textbox to display the different color
text in a
cell it references.

Thank you





LookingGood

Keep text color
 
Chip,

I have a cell that has 2 lines of data. The first line is red and the second
is blue.

In my userform the textbox references this cell. I would like the text to be
displayed as it appears in the cell.

Can this be achieved.....


"Chip Pearson" wrote:

You're writing skills are not very clear. It isn't clear whether
the text box should take the color of the cell or the cell should
take the color of the text box.
If you want the text box to take the color of a cell, use

Private Sub UserForm_Initialize()
Me.TextBox1.BackColor = Range("A1").Interior.Color
End Sub

If you want the cell to take the color of the text box, use

Range("A1").Interior.Color = Me.TextBox1.BackColor


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"LookingGood" wrote in
message
...
Hi All,

How can I get a Userform textbox to display the different color
text in a
cell it references.

Thank you







All times are GMT +1. The time now is 09:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com