Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / 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
    133

    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'
    VB:
    With Worksheets("Sheet1").Range("B8:I10").BorderAround 
        [INDENT].LineStyle = xlContinuous[/INDENT] 
        [INDENT].Weight = xlThick[/INDENT] 
    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 07:01. Reason: revise thread title

    Excel Video Tutorials / Excel Dashboards Reports


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

    Re: Apply outside border to selected cells using VBA

    VB:
    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
    133

    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 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

  1. Add Border Around Selection
    By JoePineapples in forum EXCEL HELP
    Replies: 4
    Last Post: August 26th, 2007, 20:32
  2. Border Like Error
    By kippy in forum EXCEL HELP
    Replies: 1
    Last Post: January 23rd, 2007, 06:18
  3. border around cells with same value
    By dweerdtp in forum EXCEL HELP
    Replies: 10
    Last Post: April 23rd, 2006, 05:38

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