the code work properly to filling table cells with sequential numbers, like
1
2
3
etc..
i want to modified that code can work addition mark dot (.)
1.
2.
3.
Code: Select all
Sub AddNumbersToTable()
Dim RowNum As Long
Dim ColNum As Long
Dim iStartNum As Integer
Dim J As Integer
If Selection.Information(wdWithInTable) Then
RowNum = Selection.Cells(1).RowIndex
ColNum = Selection.Cells(1).ColumnIndex
iStartNum = Val(Selection.Cells(1).Range.Text)
If iStartNum <> 0 Then
iStartNum = iStartNum + 1
For J = RowNum + 1 To ActiveDocument.Tables(1).Rows.Count
ActiveDocument.Tables(1).Cell(J, ColNum).Range.Text = iStartNum
iStartNum = iStartNum + 1
Next
Else
MsgBox "Cell doesn't contain a non-zero starting number."
Exit Sub
End If
Else
MsgBox "Not in table"
End If
End Sub
susan