![]() |
|
#1
|
|||
|
|||
![]()
This is the final code.
Sub subNumberTableColumns() Dim objTable As Table Dim intRowNo As Integer Dim intCounter As Integer On Error GoTo Error_subNumberTableColumns '--------------------------------------------------------------- ' Must be in a table to delete it If funIsTable = False Then MsgBox "You must be in a table to number the table.", vbCritical, "Number Block" GoTo Exit_subNumberTableColumns Else ' In a table Set objTable = Selection.Tables(1) intRowNo = objTable.Rows.Count ' Rows in the table objTable.Cell(2, 1).Select ' Go to the cell below the header '--------------------------------------------------------------- ' Enter numbers in each row For intCounter = 1 To intRowNo - 1 ' Number of rows minus the header Selection.HomeKey Unit:=wdLine ' Start of the line Selection.Range.Text = intCounter & ". " Selection.MoveDown Next intCounter End If Exit_subNumberTableColumns: On Error GoTo 0 Exit Sub Error_subNumberTableColumns: MsgBox "An unexpected situation arose in your program." & vbCrLf & _ "Please write down the following details:" & vbCrLf & vbCrLf & _ "Module Name: " & "(MODULE_NAME)" & vbCrLf & _ "Type: VBA Document: " & vbCrLf & _ "Calling Procedure: " & "(PROCEDURE_NAME}" & vbCrLf & _ "Error Number: " & Err.Number & vbCrLf & _ "Error Descritption: " & Err.Description & vbCrLf & vbCrLf & _ "Resume Exit_" & "(PROCEDURE_NAME)" & vbCrLf & _ "Resume" End Sub Thanks Greg |
![]() |
Tags |
nested table |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Jennifer Murphy | Word Tables | 11 | 08-23-2016 09:37 PM |
simple way to count rows in a table? | bkcell | Word | 4 | 03-09-2015 09:06 PM |
copying nested if over multiple rows where one value stays fixed | charles_cat | Excel | 1 | 01-23-2015 01:30 AM |
![]() |
Hoochtheseal | Word VBA | 1 | 01-29-2013 09:23 PM |
Nested vlookup with varable tables! | Dave Jones | Excel | 0 | 08-30-2012 09:15 AM |