![]() |
#5
|
||||
|
||||
![]()
OK if you only want the parenthesis in the right cell and after each paragraph there modify the previous macro as follows:
http://www.gmayor.com/installing_macro.htm Code:
Sub NextCell() Dim iWidth As Long Dim iCol As Long Dim iRow As Long Dim oRow As Row Dim oRng As Range Dim oCell As Cell Dim oPara As Paragraph Dim rPara As Range Dim oTable As Table If Selection.Information(wdWithInTable) = True Then Set oTable = Selection.Tables(1) Set oRow = Selection.Rows(1) iRow = oRow.Index iCol = oRow.Cells.Count Set oCell = oTable.Cell(iRow, iCol) 'If the cursor is not in the last cell of the table, move to the next cell If Not Selection.InRange(oCell.Range) Or _ Not Selection.InRange(oTable.Rows.Last.Range) Then Selection.Cells(1).Next.Select Selection.Collapse 1 GoTo lbl_Exit End If 'Cursor is in the last cell of the table 'Locate the end of the cell range iWidth = oCell.Width - 12 'and add a right aligned tab oCell.Range.ParagraphFormat.TabStops.Add _ Position:=iWidth, _ Alignment:=wdAlignTabRight, _ Leader:=wdTabLeaderSpaces 'set a range to the cell with the cursor Set oRng = oCell.Range 'remove the end of cell character oRng.End = oRng.End - 1 For Each oPara In oRng.Paragraphs 'add a right bracket at the end of each paragraph in the Right cell Set rPara = oPara.Range rPara.End = rPara.End - 1 rPara.InsertAfter vbTab & ")" Next oPara 'and add a new row to the table Set oRow = oTable.Rows.Add 'select the first cell of the new row oRow.Cells(1).Select 'move the selection to the start of the cell Selection.Collapse 1 End If lbl_Exit: Set oTable = Nothing Set oPara = Nothing Set oRow = Nothing Set oCell = Nothing Set oRng = Nothing Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
Tags |
border lines, legal pleading |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
vote4gop | Word | 5 | 02-28-2015 10:44 PM |
![]() |
n00bie-n00b | Word VBA | 6 | 10-08-2014 11:54 PM |
![]() |
l39linden | Word Tables | 5 | 10-04-2013 02:06 AM |
![]() |
tinfanide | Word | 4 | 10-27-2012 06:35 AM |
![]() |
msbytes | Word | 4 | 08-15-2011 09:21 AM |