+ Reply to Thread
Results 1 to 3 of 3

How do I set text alignment in code.

  1. #1
    Patch61
    Guest

    How do I set text alignment in code.

    The help files for programming in excel are ridiculously atrocious. It's way
    too hard to find what you are looking for.

    What I want to know is how do I set the alignment (justification) of text in
    a cell using vb code?



  2. #2
    Jim Cone
    Guest

    Re: How do I set text alignment in code.

    The "best" Excel help exists in XL 97. It responds much quicker and gives you "mush"
    when you enter mush not "soup". I have/use three versions of XL, but use the XL 97
    help for all of them. From that help file...

    "HorizontalAlignment Property"
    Returns or sets the horizontal alignment for the object. Read/write Long

    For all objects, this can be one of the following XlHAlign constants:
    xlHAlignCenter, xlHAlignDistributed, xlHAlignJustify, xlHAlignLeft, or xlHAlignRight.

    In addition, for the Range or Style object, this property can be set to:
    xlHAlignCenterAcrossSelection, xlHAlignFill, or xlHAlignGeneral.

    This example left aligns the range A1:A5 on Sheet1...
    Worksheets("Sheet1").Range("A1:A5").HorizontalAlignment = xlLeft
    --
    Jim Cone
    San Francisco, USA
    http://www.realezsites.com/bus/primitivesoftware



    "Patch61" <Patch61@discussions.microsoft.com>
    wrote in message
    The help files for programming in excel are ridiculously atrocious. It's way
    too hard to find what you are looking for.
    What I want to know is how do I set the alignment (justification) of text in
    a cell using vb code?



  3. #3
    Patch61
    Guest

    RE: How do I set text alignment in code.

    found it:
    Worksheets("Sheet1").Range("A1:A5").HorizontalAlignment = xlLeft

    "Patch61" wrote:

    > The help files for programming in excel are ridiculously atrocious. It's way
    > too hard to find what you are looking for.
    >
    > What I want to know is how do I set the alignment (justification) of text in
    > a cell using vb code?
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1