Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel

Status
Not open for further replies.

Santa123

Mechanical
Oct 2, 2006
80
PL
Hi,

I do not know how to align text in cells. I've been trying .... and nothing.

With Excel.Range("A1", "D5")
.Font.Bold = True
.Font.Name = "Tahoma"
.Font.Size = 12
.Font.ColorIndex = 3
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter

End With

Respect
Santa123
 
Replies continue below

Recommended for you

Hi ferdo,

This is code from recording macro in Excel

Best Regards
Santa123
 
For me is looking like this (Excel 2007, Win 7 x64)

Code:
Sub Macro1()

    Range("A1:D5").Select
    With Selection
        .HorizontalAlignment = xlLeft
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
End Sub

Regards
Fernando

 
Mine looks like this (Excel 2007 SP2):

Range("F1,H1").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With

-
 
But when I put

.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom

in Catia script, it makes error.
 
It works, thanks a lot. Why do you need to define numeric value for .HorizontalAlignment and
.VerticalAlignment. These values -4108 and -4107, why not -11 and -10

Best Regards
Santa123
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top