View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default mixed formatting in same cell with VBA

You sure you wouldn't want spaces between each part of the name?

In any case, maybe this'll give you a start:

Option Explicit
Private Sub CommandButton1_Click()
With Worksheets("sheet1").Range("a1")
.Value = Me.TextBox1.Value & Me.TextBox2.Value & Me.TextBox3.Value
With .Characters(Start:=Len(Me.TextBox1.Value) + 1, _
Length:=Len(Me.TextBox3.Value)).Font
.FontStyle = "Bold"
End With
End With
End Sub

Horatio J. Bilge, Jr. wrote:

Is it possible to have two different text formats in the same cell when using
VBA?

For example, I am using the textboxes from a userform to fill a cell:
WS.Cells(1, 1).Value = Me.txtFirst.Value & Me.txtMiddle.Value &
Me.txtLast.Value

I want to make the font format of one of the values different from the
others. For example, so the end result would be: txtFirst <btxtMiddle</b
txtLast.


--

Dave Peterson