Announcement

Collapse
No announcement yet.

Unconfigured Ad Widget

Collapse

Apply outside border to selected cells using VBA

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Apply outside border to selected cells using VBA

    I tried researching this but didn't come up with anything that worked quite right. I need to create a vba code that puts a border around the outside of the selected cells (all of the cell borders on the inside are not included)

    I tried the following but keep getting runtime error '424'
    Code:
    With Worksheets("Sheet1").Range("B8:I10").BorderAround
    .LineStyle = xlContinuous
    .Weight = xlThick
    End With
    The selection ranges from a few columns in one row to many rows and columns if this makes a difference
    Last edited by AAE; May 6th, 2011, 07:01. Reason: revise thread title

  • #2
    Re: Apply outside border to selected cells using VBA

    Code:
    With Sheet1.Range("B8:I10")
        .Borders(xlEdgeLeft).LineStyle = xlContinuous
        .Borders(xlEdgeRight).LineStyle = xlContinuous
        .Borders(xlEdgeBottom).LineStyle = xlContinuous
        .Borders(xlEdgeTop).LineStyle = xlContinuous
    End With
    The sheet reference above is the sheet code name
    AAE
    ----------------------------------------------------

    Forum Rules | Message to Cross Posters | How to use Tags

    Comment


    • #3
      Re: Apply outside border to selected cells using VBA

      Works great thank you!

      Comment

      Trending

      Collapse

      There are no results that meet this criteria.

      Working...
      X