Grid with Frame->All: How to not draw frames around empty cells?
You may use Item
.
Grid@Map[Item[#, Frame -> All] &, Partition[Range@17, UpTo@7], {2}]
Hope this helps.
Adapted from the "Frame specific elements" example in the docs for Grid
under the subsection Options > Frame:
With[{items = Partition[Range@17, UpTo@7]},
Grid[items, Frame -> {None, None, Thread[Position[items, _, {2}] -> True]}]
]