Consulting

Results 1 to 3 of 3

Thread: Solved: Put borders around selected range

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Solved: Put borders around selected range

    Hello members!

    Not much of a programmer.

    All I want to do is put a thin line border around each cell in the selected range.

    I used the macro recorder and it generated about 50 lines of code. I kind of figured that it could be done with a few lines of code using a For Next loop but I'm failing miserably!

    Basically, I want to do this:

    For each cell in selection
    put a thin line border around the cell
    next cell

    Can anyone point me in the right direction?

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Looping is not needed
    [VBA]Sub trial()
    With Selection.Borders
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
    End With
    End Sub[/VBA]

  3. #3
    Nice and compact.

    Works very well.

    Thank you, mikerickson

Posting Permissions

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