+ Reply to Thread
Results 1 to 12 of 12

VBA - Putting a border around cells that arent empty

  1. #1
    Registered User
    Join Date
    06-24-2008
    Posts
    98

    VBA - Putting a border around cells that arent empty

    Hello all,

    I am stuck on a project. I am trying to Put a border around cells that arent empty. Is this possible?

    I have tried playing with this code but got stuck.

    Please Login or Register  to view this content.
    Can anyone help? I would be really grateful.
    Last edited by Chris424; 11-03-2008 at 11:08 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You don't need a Loop

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    06-24-2008
    Posts
    98
    Thank you, This gives me an error? Does it work for you?

    The error 91 is on line
    Please Login or Register  to view this content.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Works fine for me. Check the Border Format by using the Macro Recorder

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    Roy your code dows empty cells. Think the OP want's non empty cells.
    In which case a different argument is requried for the SpecialCells method.
    Cheers
    Andy
    www.andypope.info

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try this

    Please Login or Register  to view this content.
    VBA Noob
    Last edited by VBA Noob; 11-03-2008 at 09:37 AM. Reason: Amend code for Non blanks
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Quote Originally Posted by Andy Pope View Post
    Roy your code dows empty cells. Think the OP want's non empty cells.
    In which case a different argument is requried for the SpecialCells method.
    I misread that Andy

    Use
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    06-24-2008
    Posts
    98
    I tried all these ideas but still get various errors.
    I have attached a spreadsheet would someone mind taking a look? Thankyou for all ur help
    Attached Files Attached Files

  9. #9
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    You have no formula cells so this quick change will give you a border around the first column.

    Please Login or Register  to view this content.
    Is that what you want?

  10. #10
    Registered User
    Join Date
    06-24-2008
    Posts
    98
    That is what I was after! Is it possible to have each cell seperated? like the ones in yellow on my attachment?
    Attached Files Attached Files

  11. #11
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    06-24-2008
    Posts
    98
    That works perfectly! Thankyou very much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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