Microsoft Excel Webinar

Results 1 to 3 of 3

Thread: Solved: Put borders around selected range

  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
    Looping is not needed
    VB:
    Sub trial() 
        With Selection.Borders 
            .LineStyle = xlContinuous 
            .Weight = xlThin 
            .ColorIndex = xlAutomatic 
        End With 
    End Sub 
    
    
    Formatting tags added by mark007

  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
  •