Hello,
I have attached a sample that really looks like my current excel file. For some reason the file is about 1.2 Mo so I had to zip the Excel file :-S I do not get it as there is no pictures, only one worksheet and 2 marcros..
Anyway, the document is protected (P@ssw0rd!)
Now I will expose my problem. If you click on the "SAVE" button it will copy of the current worksheet and paste it to a new worksheet. In the attachement, you can see that in row 92 there is no bottom line and the table is then not close from B92:I92 from page 1 to page 2.
I need to close the table from the page 1. I tried to implement in the macro "Version1" the following macro:
Sub test()
Dim rng As Range, sh As Worksheet, breaks_count as long
On Error Resume Next
Set sh = ActiveSheet
breaks_count = sh.HPageBreaks.Count
For i = 1 To breaks_count
If rng Is Nothing Then Set rng = sh.Cells(sh.HPageBreaks(i).Location.Row - 1, 1) Else Set rng = Union(sh.Cells(sh.HPageBreaks(i).Location.Row - 1, 1), rng)
Next
If Not rng Is Nothing Then rng.Borders(xlEdgeBottom).Weight = xlThin
End Sub
But it doesn't work....
Can you please tell me if it would be possible to close the table in the copied worksheet or even in the all worksheet.
I thought about the above macro as the copied worksheet will not have any added rows so the bottom lines will stay exactly where they are. But if you have a solution to close the table please let me know ! (take into account that the table design should stay as is.
Many thanks in advance,
Graig
Bookmarks