Results 1 to 5 of 5

Need a macro to create borders for the top row but

Threaded View

  1. #1
    Registered User
    Join Date
    01-09-2012
    Location
    here
    MS-Off Ver
    Excel 2003
    Posts
    68

    Need a macro to create borders for the top row but

    Need a macro to create borders for the top row but the amount of columns always change so the code would need to know where the data end.

    Also if its possbile to as well create a border around the body of the data which isnt always the same too. I recorded how i create my top borders below.

    Sub Macro2()
    '
    ' Macro2 Macro
    '
    
    '
        Range("A1:U1").Select
        Range("U1").Activate
        Selection.Borders(xlDiagonalDown).LineStyle = xlNone
        Selection.Borders(xlDiagonalUp).LineStyle = xlNone
        With Selection.Borders(xlEdgeLeft)
            .LineStyle = xlContinuous
            .ColorIndex = xlAutomatic
            .TintAndShade = 0
            .Weight = xlMedium
        End With
        With Selection.Borders(xlEdgeTop)
            .LineStyle = xlContinuous
            .ColorIndex = xlAutomatic
            .TintAndShade = 0
            .Weight = xlThick
        End With
        With Selection.Borders(xlEdgeBottom)
            .LineStyle = xlDouble
            .ColorIndex = xlAutomatic
            .TintAndShade = 0
            .Weight = xlThick
        End With
        With Selection.Borders(xlEdgeRight)
            .LineStyle = xlContinuous
            .ColorIndex = xlAutomatic
            .TintAndShade = 0
            .Weight = xlMedium
        End With
        With Selection.Borders(xlInsideVertical)
            .LineStyle = xlContinuous
            .ColorIndex = xlAutomatic
            .TintAndShade = 0
            .Weight = xlThin
        End With
        Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
        With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .Color = 12632256
            .TintAndShade = 0
            .PatternTintAndShade = 0
        End With
    End Sub
    Last edited by daillest319; 01-12-2012 at 01:07 PM.

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