![]() |
|
|
|
#1
|
|||
|
|||
|
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
|
|
| Tags |
| skip columns, split, table |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Insert 8 columns into 3 columns | BendixB | Excel Programming | 2 | 08-08-2018 12:39 PM |
| Adding selected entries in columns in Excel | hillbilly | Excel | 4 | 07-16-2015 01:07 AM |
| Split one column to several columns | moishy | Excel Programming | 1 | 02-01-2013 12:50 AM |
| Independent, Split Columns in Word? | dave0620 | Word | 3 | 12-12-2011 07:15 PM |
How to compare 2 columns with other two columns in EXECL 2007?
|
Learner7 | Excel | 5 | 06-12-2010 09:54 AM |