Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Mar 2001
    Posts
    165
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Conditional formatting: alignment (Excel 97 SR2)

    I want to format a column of cells so that they alternate left and right text alignment. Can anyone help?
    Clark

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conditional formatting: alignment (Excel 97 SR2)

    This macro will alternate the alignment of the current selection:

    <pre>Public Sub SetAlign()
    Dim oCell As Range
    For Each oCell In Selection
    If oCell.Row Mod 2 = 0 Then
    oCell.HorizontalAlignment = xlHAlignLeft
    Else
    oCell.HorizontalAlignment = xlHAlignRight
    End If
    Next oCell
    End Sub
    </pre>

    Legare Coleman

  3. #3
    2 Star Lounger
    Join Date
    Mar 2001
    Posts
    165
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conditional formatting: alignment (Excel 97 SR2)

    Thanks very much!

Posting Permissions

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