+ Reply to Thread
Results 1 to 9 of 9

VBA to Add Borders

  1. #1
    Forum Contributor
    Join Date
    02-09-2009
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    380

    VBA to Add Borders

    Hey Guys, I've watched quite a few tutorials and read many articles now regarding borders and after spending all day and trying most combinations I cannot get this to work.

    Please Login or Register  to view this content.
    I've already tried:
    • Changing the HeadersID to a speicific range; incase the With cmd cannot address Range Names
    • .LineStyle:= xlContinuous
    • And many, many, many other combinations.
    The best tutorial is https://youtu.be/JT6C07BzWGk and I've followed it exactly apart from referring to a range name but I cannot get it to work; which makes me think there's something wrong with my VBA?
    If it's been helpful please mark as helpful

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: VBA to Add Borders

    try
    Please Login or Register  to view this content.
    If someone has helped you then please add to their Reputation

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA to Add Borders

    Try this...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Forum Contributor
    Join Date
    02-09-2009
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    380

    Re: VBA to Add Borders

    Thanks guys, I spent all day on this. I swear I had it like that too. Really angry at myself for spending a day on this.

    Massive thanks to you both.

  5. #5
    Forum Contributor
    Join Date
    02-09-2009
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    380

    Re: VBA to Add Borders

    Sorry guys, I'm really struggling with borders. What's the deal with the .BorderAround method?

    I'm getting errors again around the .LineStyle
    Please Login or Register  to view this content.
    I've tried:
    Please Login or Register  to view this content.
    Sorry to abuse your kindness here guys.
    Last edited by Dal123; 11-25-2016 at 01:10 PM.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA to Add Borders

    Please Login or Register  to view this content.
    You can highlight the BorderAround keyword in the VBA editor and press F1 for syntax help and example code.

  7. #7
    Forum Contributor
    Join Date
    02-09-2009
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    380

    Re: VBA to Add Borders

    Thanks Alpha, cool feature I wasn't aware of there so thanks very much.

    It seems like this is identical to the VBA help, I have it carrying out the code so no syntax errors but it's not actually displaying a border. Just when I think I have it sussed it kicks me in the teeth; lol.
    Please Login or Register  to view this content.
    Last edited by Dal123; 11-25-2016 at 01:47 PM.

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA to Add Borders

    It's not identical to the help. Did you try the one line I suggested without the With statement?

    I think your issue, in this case, is not understanding the difference between an Object and a Method. The With statement refers to a an Object like the .Borders collection of a Range . So you can use the With statement for say a Range("A1").Borders

    The .BorderAround is a method (not an object). You cannot use the With statement on a method.

    Understanding Objects, Properties, and Methods
    Last edited by AlphaFrog; 11-25-2016 at 02:59 PM.

  9. #9
    Forum Contributor
    Join Date
    02-09-2009
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    380

    Re: VBA to Add Borders

    Thanks Alpha, I get what you're saying. I've spent two weeks 14 hours a day watching tutorials creating the files and following lessons. I should understand this; really disappointed in myself. Thank you greatly for your input - much appreciated.

    Yeah I copied that baby in but no joy, I also tried ActiveSheet. infornt of it.
    Last edited by Dal123; 11-25-2016 at 08:05 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] borders
    By backyardfun in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-02-2014, 12:18 PM
  2. [SOLVED] Auto change borders to thick borders
    By Pierce Quality in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-22-2013, 11:17 PM
  3. Replies: 3
    Last Post: 02-20-2012, 05:09 PM
  4. Add borders
    By nighttrainrex in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-25-2010, 05:57 PM
  5. Excel 2007 : VBA & Borders
    By LeoS in forum Excel General
    Replies: 1
    Last Post: 11-18-2009, 04:30 AM
  6. borders
    By galarza in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 10-09-2009, 08:10 AM
  7. borders
    By jobra in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-30-2005, 06:05 AM
  8. borders
    By Brush Prairie in forum Excel General
    Replies: 0
    Last Post: 08-22-2005, 10:05 PM

Tags for this Thread

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1