Results 1 to 1 of 1

Macro to close table with Bottom line

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-21-2007
    MS-Off Ver
    Microsoft 365 Apps for enterprise
    Posts
    389

    Macro to close table with Bottom line

    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
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Add a table to the bottom of a table using a macro
    By bukkibams in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-21-2013, 11:39 AM
  2. Add a row to the bottom of a table using a macro?
    By MilkyQuail in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-21-2013, 10:35 AM
  3. New Line at the bottom of a Table
    By CodeEnforcer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-26-2013, 02:27 PM
  4. Keepin total line (bottom line) static
    By milbogo in forum Excel General
    Replies: 1
    Last Post: 08-05-2008, 10:54 PM
  5. Run A Macro Against a Table Until it gets to bottom
    By racer25 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-04-2005, 12:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1