ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to have textbox font color change? (https://www.excelbanter.com/excel-programming/397129-how-have-textbox-font-color-change.html)

Phrank

How to have textbox font color change?
 
I've got a form with a text box called Notes. The notes get added to
a spreadsheet to update a NOTES cell for a given report number. I
want to have the color of the text that gets added to the spreadsheet
be red, but I can't figure out how to do this. It's not the whole
Notes cell that I want to change the color, but rather just the text
that is entered via the Notes text box. I have a few forms where
different people enter Notes into the same cell, and the notes get
concatenated. Having these notes color coded will help identify where
they came from. Thanks for any help.

Frank

Tom Ogilvy

How to have textbox font color change?
 
Private Sub CommandButton2_Click()
With Range("Notes")
With .Characters(Len(.Text) + 1, _
Len(Me.Controls("Notes").Text))
.Text = Me.Controls("Notes").Text
.Font.ColorIndex = 3
End With
End With
End Sub

Worked for me.

--
Regards,
Tom Ogilvy



"Phrank" wrote:

I've got a form with a text box called Notes. The notes get added to
a spreadsheet to update a NOTES cell for a given report number. I
want to have the color of the text that gets added to the spreadsheet
be red, but I can't figure out how to do this. It's not the whole
Notes cell that I want to change the color, but rather just the text
that is entered via the Notes text box. I have a few forms where
different people enter Notes into the same cell, and the notes get
concatenated. Having these notes color coded will help identify where
they came from. Thanks for any help.

Frank


Phrank

How to have textbox font color change?
 
Hi Tom,

I tried this a couple different ways, and I kept getting errors. Where
you have Range("Notes"), are you referring to the actual cell where
the notes are entered, or are you referring to the textbox in which
the note is entered? I have the notes cell identified as
'myNotesRange', and the notes textbox is called textNotes. I
appreciate your help (and you have helped me out a lot in the past
too!).

Frank

On Sat, 8 Sep 2007 19:32:01 -0700, Tom Ogilvy
wrote:

Private Sub CommandButton2_Click()
With Range("Notes")
With .Characters(Len(.Text) + 1, _
Len(Me.Controls("Notes").Text))
.Text = Me.Controls("Notes").Text
.Font.ColorIndex = 3
End With
End With
End Sub

Worked for me.


Tom Ogilvy

How to have textbox font color change?
 
I've got a form with a text box called Notes. The notes get added to
a spreadsheet to update a NOTES cell for a given report number


That says to me the Notes cell is named "Notes" (insert=Name =Define,
Name: Notes, Refers to: =Sheet1!$B$9

as an example.

--
Regards,
Tom Ogilvy

"Phrank" wrote:

Hi Tom,

I tried this a couple different ways, and I kept getting errors. Where
you have Range("Notes"), are you referring to the actual cell where
the notes are entered, or are you referring to the textbox in which
the note is entered? I have the notes cell identified as
'myNotesRange', and the notes textbox is called textNotes. I
appreciate your help (and you have helped me out a lot in the past
too!).

Frank

On Sat, 8 Sep 2007 19:32:01 -0700, Tom Ogilvy
wrote:

Private Sub CommandButton2_Click()
With Range("Notes")
With .Characters(Len(.Text) + 1, _
Len(Me.Controls("Notes").Text))
.Text = Me.Controls("Notes").Text
.Font.ColorIndex = 3
End With
End With
End Sub

Worked for me.




All times are GMT +1. The time now is 08:44 AM.

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