View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Ryan H Ryan H is offline
external usenet poster
 
Posts: 489
Default Conditional formatting in text boxes

Since you didn't post any code you probably have lots of options. Do you
change the values of the cells using the Userform interface or the worksheet?


If the worksheet and you didn't change the default Textbox names, then you
probably want to setup a Worksheet_Change Event call a sub like this:

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column = "B" Then
Call TextBoxBolding(Target.Row)
End If

End Sub

Sub TextBoxBolding(rw As Long)
Me.Controls("Textbox" & rw).Font.Bold = Not Cells(rw, "B").Text = ""
End Sub

Or you could put Jacob's code in your Userform_Intialize Event.

Private Sub UserForm_Initialize()

Dim i As Long

For i = 1 To 60
Me.Controls("Textbox" & i).Font.Bold = Not Cells(i, "B").Text = ""
Next i

End Sub

Hope this helps! If so, let me know, click "YES" below.
--
Cheers,
Ryan


"Roger on Excel" wrote:

I have textboxes on a userform.

The text boxes read (and write) to cells A1:A60

Adjacent to these cells I have a comments column which is filled in for
particular rows

Depending on whether the adjacent cell in column B has an entry, is there a
way to make the textboxes change their font attributes? For example, become
BOLD when there is a comment.

Can anyone help?