+ Reply to Thread
Results 1 to 2 of 2

Borders around cells...

  1. #1
    Registered User
    Join Date
    09-22-2005
    Posts
    3

    Post Borders around cells...

    I do not know how to word my problem so let me explain the process...

    From an access DB a user pushes a button then an excel document is
    built and populated using the excel object. The formatting is done
    automatically (I recorded a macro and edited the code). Columns A:G are
    selected then the border is placed down the entire columns.

    I would like to format the .xls document better. How can I limit the
    border to where the borders stop on the last row of data on the .xls
    doc?

    Any ideas or tips will be greatly appreciated.

  2. #2
    Tom Ogilvy
    Guest

    Re: Borders around cells...

    Possibly

    Sub DoBorders()
    Dim rng As Range
    With ActiveSheet
    Set rng = Intersect(.Columns("A:M"), .UsedRange)
    End With
    With rng
    .Borders(xlDiagonalDown).LineStyle = xlNone
    .Borders(xlDiagonalUp).LineStyle = xlNone
    With .Borders(xlEdgeLeft)
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
    End With
    .Borders(xlEdgeTop).LineStyle = xlNone
    .Borders(xlEdgeBottom).LineStyle = xlNone
    With .Borders(xlEdgeRight)
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
    End With
    With .Borders(xlInsideVertical)
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
    End With
    .Borders(xlInsideHorizontal).LineStyle _
    = xlNone
    End With
    End Sub


    Adjust to suit what you are actually doing and the columns you want to
    address.

    The above just puts borders on the vertical edges, but can be adjusted to
    whatever you want.

    --
    Regards,
    Tom Ogilvy

    "syuhas" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I do not know how to word my problem so let me explain the process...
    >
    > From an access DB a user pushes a button then an excel document is
    > built and populated using the excel object. The formatting is done
    > automatically (I recorded a macro and edited the code). Columns A:G
    > are
    > selected then the border is placed down the entire columns.
    >
    > I would like to format the .xls document better. How can I limit the
    > border to where the borders stop on the last row of data on the .xls
    > doc?
    >
    > Any ideas or tips will be greatly appreciated.
    >
    >
    > --
    > syuhas
    > ------------------------------------------------------------------------
    > syuhas's Profile:

    http://www.excelforum.com/member.php...o&userid=27486
    > View this thread: http://www.excelforum.com/showthread...hreadid=517364
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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