Results 1 to 3 of 3

Thread: Excel VBA borders

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    193

    Excel VBA borders

    This may not be the right forum, but I am usine VBA in Excel(Yuck), I have to group 3 cells together in the same column. I don't want the interior lines to show inside but I do want a border around them. I can't merge,this deletes data, I haven't found the right Border properties to use.
    Thanks for help

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Excel VBA borders

    Thread moved to Office Development/VBA forum

  3. #3
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Excel VBA borders

    In Object Browser, search for "xlBordersIndex" for all border index values

    Try to record a macro you will learn from that.
    However, this is the shortest modified code that will do the task:
    Code:
    Dim b As Integer
    
    With Sheet1.Range("C3:C5")
        For b = xlDiagonalDown To xlInsideHorizontal '-- 5 To 12
            Select Case b
                'Case xlEdgeLeft, xlEdgeTop, xlEdgeBottom, xlEdgeRight '-- 7, 8, 9, 10
                Case xlEdgeLeft To xlEdgeRight '-- 7 to 10
                    .Borders(b).LineStyle = xlContinuous
                    .Borders(b).Weight = xlThin
                Case Else
                    .Borders(b).LineStyle = xlNone
            End Select
        Next
    End With
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width