View Single Post
 
Old 09-20-2019, 07:02 AM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,601
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Try this:


Code:
Sub test_Split_and_Align_1_tbl()
Application.ScreenUpdating = False
Dim oTbl As Table
Dim lngRow As Long, lngCol As Long
Dim oRng As Range
  Set oTbl = Selection.Tables(1)
  Set oRng = oTbl.Range
  oRng.Start = oTbl.Columns(2).Cells(1).Range.Start
  oRng.Select
  Selection.Cells.Split 1, 2, False
  For lngCol = 3 To oTbl.Columns.Count Step 2
    oTbl.Columns(lngCol).Width = 48
  Next lngCol
  For lngCol = 4 To oTbl.Columns.Count Step 2
    oTbl.Columns(lngCol).Width = 12
  Next lngCol
  For lngRow = 1 To oTbl.Rows.Count
    For lngCol = 3 To oTbl.Columns.Count
      If lngCol Mod 2 = 1 Then 'an odd column
        oTbl.Cell(lngRow, lngCol).Range.ParagraphFormat.Alignment = wdAlignParagraphRight
      Else
        oTbl.Cell(lngRow, lngCol).Range.ParagraphFormat.Alignment = wdAlignParagraphLeft
      End If
    Next lngCol
  Next lngRow
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote