Thread
:
Userform textbox string to header causes unwanted double spacing
View Single Post
#
2
Posted to microsoft.public.excel.programming
Claus Busch
external usenet poster
Posts: 3,872
Userform textbox string to header causes unwanted double spacing
Hi Ken,
Am Mon, 17 Nov 2014 08:01:05 -0800 (PST) schrieb
:
The string is entered into the header with
ActiveSheet.PageSetup.CenterHeader = TextBox1.Value
with some testing I came to this result:
Private Sub UserForm_Initialize()
Dim str As String
str = Sheets("Sheet12").Range("ship").Text & Chr(10) & _
Sheets("Sheet12").Range("clin").Text
Me.TextBox1.Text = str
End Sub
And then for the center header:
With UserForm1.TextBox1
ActiveSheet.PageSetup.CenterHeader = _
Left(.Text, InStr(.Text, Chr(10)) - 1) & "Total Cost" & _
Chr(10) & Mid(.Text, InStr(.Text, Chr(10)) + 1)
End With
Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
Reply With Quote
Claus Busch
View Public Profile
Find all posts by Claus Busch