View Full Version : [SOLVED:] Insert rows in a table uptill the page bottom
kattai
12-09-2022, 10:40 PM
Is there a way to write vba code to insert rows in a table up to the bottom of the current page. Thank you
Aussiebear
12-09-2022, 11:27 PM
Is there a way to write vba code to insert rows in a table up to the bottom of the current page.
By ".... up to the bottom of the current page" are you referring to the last used row of the sheet
kattai
12-10-2022, 12:47 AM
By ".... up to the bottom of the current page" are you referring to the last used row of the sheet
Yes
gmaxey
12-10-2022, 11:07 AM
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oTbl As Table
Dim oRng As Range
Set oTbl = Selection.Tables(1)
Set oRng = oTbl.Range
oRng.Collapse wdCollapseEnd
oRng.Move wdParagraph, 1
Do
oTbl.Rows.Add
Loop While oTbl.Rows.Last.Range.Information(wdActiveEndAdjustedPageNumber) = oRng.Information(wdActiveEndAdjustedPageNumber)
lbl_Exit:
Exit Sub
End Sub
Aussiebear
12-10-2022, 01:20 PM
My apologies kattai, your initial post was correct.
kattai
12-10-2022, 11:29 PM
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oTbl As Table
Dim oRng As Range
Set oTbl = Selection.Tables(1)
Set oRng = oTbl.Range
oRng.Collapse wdCollapseEnd
oRng.Move wdParagraph, 1
Do
oTbl.Rows.Add
Loop While oTbl.Rows.Last.Range.Information(wdActiveEndAdjustedPageNumber) = oRng.Information(wdActiveEndAdjustedPageNumber)
lbl_Exit:
Exit Sub
End Sub
Thank you Greg. It works. I appreciate your timely support.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.