Loading
Ozgrid Excel Help & Best Practices Forums

Excel Training / Excel Dashboards Reports



Results 1 to 3 of 3

Thread: Apply outside border to selected cells using VBA

  1. #1
    Join Date
    14th April 2011
    Location
    California
    Posts
    137

    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 at 08:01. Reason: revise thread title

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    19th January 2007
    Location
    South Carolina, USA
    Posts
    9,205

    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

  3. #3
    Join Date
    14th April 2011
    Location
    California
    Posts
    137

    Re: Apply outside border to selected cells using VBA

    Works great thank you!

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. border around cells with same value
    By dweerdtp in forum EXCEL HELP
    Replies: 11
    Last Post: May 1st, 2015, 04:47
  2. Add Border Around Selection
    By JoePineapples in forum EXCEL HELP
    Replies: 4
    Last Post: August 26th, 2007, 21:32
  3. Border Like Error
    By kippy in forum EXCEL HELP
    Replies: 1
    Last Post: January 23rd, 2007, 07:18

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
  •  
porno