rows in tables 2007

B

Billj

How do I insert a specified number of rows in tables in word 2007 without
having to select the number of ros in the existing table ie 20 rows to the
end of a table
 
D

Doug Robbins - Word MVP on news.microsoft.com

If you run a macro containing the following code, it will ask you how many
rows you want to add to the end of table in which the selection is located.

Dim i As Long
If Selection.Information(wdWithInTable) Then
For i = 1 To InputBox("Enter the number of rows that you want to add")
Selection.Tables(1).Rows.Add
Next i
Else
MsgBox "The selection must be inside the table to which you want to add
the rows."
End If

If you want them added before the row in which the selection is located, use

Dim i As Long
If Selection.Information(wdWithInTable) Then
For i = 1 To InputBox("Enter the number of rows that you want to add")
Selection.Tables(1).Rows.Add Selection.Rows(1)
Next i
Else
MsgBox "The selection must be inside the table to which you want to add
the rows."
End If


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
B

Billj

Thank you very much, will see how we go.

Doug Robbins - Word MVP on news.microsof said:
If you run a macro containing the following code, it will ask you how many
rows you want to add to the end of table in which the selection is located.

Dim i As Long
If Selection.Information(wdWithInTable) Then
For i = 1 To InputBox("Enter the number of rows that you want to add")
Selection.Tables(1).Rows.Add
Next i
Else
MsgBox "The selection must be inside the table to which you want to add
the rows."
End If

If you want them added before the row in which the selection is located, use

Dim i As Long
If Selection.Information(wdWithInTable) Then
For i = 1 To InputBox("Enter the number of rows that you want to add")
Selection.Tables(1).Rows.Add Selection.Rows(1)
Next i
Else
MsgBox "The selection must be inside the table to which you want to add
the rows."
End If


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top