From: Alberto Ast on
I have a userform just to display some info. In the form I have a textbox
where I pull lots of info including some vbtab and vbcr.

is there a way to center some of the lines texts
I would like to put some titles in the middle but center in the textbox.

my program looks like this

Private Sub UserForm_Initialize()
Me.TextBox1 = _
"Model:" & vbTab & vbTab & vbTab & Range("o12").Value & vbCr _
& "Customer: " & vbTab & vbTab & Range("n26").Value & vbCr _
& "Qty:" & vbTab & vbTab & vbTab & Range("J26").Value & vbCr & vbCr _
& "Part Description: " & vbTab & Range("O17").Value & vbCr _
& "Original P/N: " & vbTab & vbTab & Range("O14").Value & vbCr _
& "Replacement P/N: " & vbTab & Range("O20").Value & vbCr _
& "ECR Requested: " & vbTab & Range("F12").Value & vbCr & vbCr _
& "Description: " & Range("A30").Value & vbCr & vbCr _
& "Prevention: " & Range("A38").Value & vbCr & vbCr
End Sub
From: joel on

Use a listbox with multiple columns or add Microsoft Offsice Spreadsheet
object to you userform. There are a list of objects that you can add to
a userform by right click the toolbox and select additional controls.


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=170053

[url="http://www.thecodecage.com"]Microsoft Office Help[/url]

From: Ryan H on
Why don't you just put 9 Textboxes and 9 Labels on your userform? Then at
design time you can change the Caption property to "Model", "Customer", etc.
It would save you a lot of headches trying to center and format stuff. Hope
this helps! If so, let me know, click "YES" below.

Private Sub UserForm_Initialize()

Me.TextBox1 = Range("O12").Value
Me.TextBox2 = Range("N26").Value
Me.TextBox3 = Range("J26").Value
Me.TextBox4 = Range("O17").Value
Me.TextBox5 = Range("O14").Value
Me.TextBox6 = Range("O20").Value
Me.TextBox7 = Range("F12").Value
Me.TextBox8 = Range("A30").Value
Me.TextBox9 = Range("A38").Value

End Sub
--
Cheers,
Ryan


"Alberto Ast" wrote:

> I have a userform just to display some info. In the form I have a textbox
> where I pull lots of info including some vbtab and vbcr.
>
> is there a way to center some of the lines texts
> I would like to put some titles in the middle but center in the textbox.
>
> my program looks like this
>
> Private Sub UserForm_Initialize()
> Me.TextBox1 = _
> "Model:" & vbTab & vbTab & vbTab & Range("o12").Value & vbCr _
> & "Customer: " & vbTab & vbTab & Range("n26").Value & vbCr _
> & "Qty:" & vbTab & vbTab & vbTab & Range("J26").Value & vbCr & vbCr _
> & "Part Description: " & vbTab & Range("O17").Value & vbCr _
> & "Original P/N: " & vbTab & vbTab & Range("O14").Value & vbCr _
> & "Replacement P/N: " & vbTab & Range("O20").Value & vbCr _
> & "ECR Requested: " & vbTab & Range("F12").Value & vbCr & vbCr _
> & "Description: " & Range("A30").Value & vbCr & vbCr _
> & "Prevention: " & Range("A38").Value & vbCr & vbCr
> End Sub
From: Rick Rothstein on
A little more compact code...

Private Sub UserForm_Initialize()
Dim X As Long, Addresses() As String
Addresses = Split("O12 , N26, J26,O17,O14,O20, F12,A30,A38", ",")
For X = 1 To UBound(Addresses) + 1
Controls("TextBox" & X).Value = Range(Trim(Addresses(X - 1))).Value
Next
End Sub

This is also quite flexible in that if more TextBoxes are added or deleted, the only thing that needs to be changed is the list of addresses in the first argument to the Split function.

--
Rick (MVP - Excel)


"Ryan H" <RyanH(a)discussions.microsoft.com> wrote in message news:F7FD7991-C0AB-4427-9A66-7C0F8C66014C(a)microsoft.com...
> Why don't you just put 9 Textboxes and 9 Labels on your userform? Then at
> design time you can change the Caption property to "Model", "Customer", etc.
> It would save you a lot of headches trying to center and format stuff. Hope
> this helps! If so, let me know, click "YES" below.
>
> Private Sub UserForm_Initialize()
>
> Me.TextBox1 = Range("O12").Value
> Me.TextBox2 = Range("N26").Value
> Me.TextBox3 = Range("J26").Value
> Me.TextBox4 = Range("O17").Value
> Me.TextBox5 = Range("O14").Value
> Me.TextBox6 = Range("O20").Value
> Me.TextBox7 = Range("F12").Value
> Me.TextBox8 = Range("A30").Value
> Me.TextBox9 = Range("A38").Value
>
> End Sub
> --
> Cheers,
> Ryan
>
>
> "Alberto Ast" wrote:
>
>> I have a userform just to display some info. In the form I have a textbox
>> where I pull lots of info including some vbtab and vbcr.
>>
>> is there a way to center some of the lines texts
>> I would like to put some titles in the middle but center in the textbox.
>>
>> my program looks like this
>>
>> Private Sub UserForm_Initialize()
>> Me.TextBox1 = _
>> "Model:" & vbTab & vbTab & vbTab & Range("o12").Value & vbCr _
>> & "Customer: " & vbTab & vbTab & Range("n26").Value & vbCr _
>> & "Qty:" & vbTab & vbTab & vbTab & Range("J26").Value & vbCr & vbCr _
>> & "Part Description: " & vbTab & Range("O17").Value & vbCr _
>> & "Original P/N: " & vbTab & vbTab & Range("O14").Value & vbCr _
>> & "Replacement P/N: " & vbTab & Range("O20").Value & vbCr _
>> & "ECR Requested: " & vbTab & Range("F12").Value & vbCr & vbCr _
>> & "Description: " & Range("A30").Value & vbCr & vbCr _
>> & "Prevention: " & Range("A38").Value & vbCr & vbCr
>> End Sub
From: Rick Rothstein on
I meant to leave the spaces out of the list of addresses... they don't affect anything if left in (since I'm using the Trim function call) but they don't look all that nice.

--
Rick (MVP - Excel)


"Rick Rothstein" <rick.newsNO.SPAM(a)NO.SPAMverizon.net> wrote in message news:e$LlyXUlKHA.1536(a)TK2MSFTNGP06.phx.gbl...
A little more compact code...

Private Sub UserForm_Initialize()
Dim X As Long, Addresses() As String
Addresses = Split("O12 , N26, J26,O17,O14,O20, F12,A30,A38", ",")
For X = 1 To UBound(Addresses) + 1
Controls("TextBox" & X).Value = Range(Trim(Addresses(X - 1))).Value
Next
End Sub

This is also quite flexible in that if more TextBoxes are added or deleted, the only thing that needs to be changed is the list of addresses in the first argument to the Split function.

--
Rick (MVP - Excel)


"Ryan H" <RyanH(a)discussions.microsoft.com> wrote in message news:F7FD7991-C0AB-4427-9A66-7C0F8C66014C(a)microsoft.com...
> Why don't you just put 9 Textboxes and 9 Labels on your userform? Then at
> design time you can change the Caption property to "Model", "Customer", etc.
> It would save you a lot of headches trying to center and format stuff. Hope
> this helps! If so, let me know, click "YES" below.
>
> Private Sub UserForm_Initialize()
>
> Me.TextBox1 = Range("O12").Value
> Me.TextBox2 = Range("N26").Value
> Me.TextBox3 = Range("J26").Value
> Me.TextBox4 = Range("O17").Value
> Me.TextBox5 = Range("O14").Value
> Me.TextBox6 = Range("O20").Value
> Me.TextBox7 = Range("F12").Value
> Me.TextBox8 = Range("A30").Value
> Me.TextBox9 = Range("A38").Value
>
> End Sub
> --
> Cheers,
> Ryan
>
>
> "Alberto Ast" wrote:
>
>> I have a userform just to display some info. In the form I have a textbox
>> where I pull lots of info including some vbtab and vbcr.
>>
>> is there a way to center some of the lines texts
>> I would like to put some titles in the middle but center in the textbox.
>>
>> my program looks like this
>>
>> Private Sub UserForm_Initialize()
>> Me.TextBox1 = _
>> "Model:" & vbTab & vbTab & vbTab & Range("o12").Value & vbCr _
>> & "Customer: " & vbTab & vbTab & Range("n26").Value & vbCr _
>> & "Qty:" & vbTab & vbTab & vbTab & Range("J26").Value & vbCr & vbCr _
>> & "Part Description: " & vbTab & Range("O17").Value & vbCr _
>> & "Original P/N: " & vbTab & vbTab & Range("O14").Value & vbCr _
>> & "Replacement P/N: " & vbTab & Range("O20").Value & vbCr _
>> & "ECR Requested: " & vbTab & Range("F12").Value & vbCr & vbCr _
>> & "Description: " & Range("A30").Value & vbCr & vbCr _
>> & "Prevention: " & Range("A38").Value & vbCr & vbCr
>> End Sub