Link to home
Start Free TrialLog in
Avatar of Buck Beasom
Buck BeasomFlag for United States of America

asked on

Can I Create Cell Borders In Excel Using Late Binding

I want to put thin borders around certain cells in Excel, but I don't want the aggravation of using early binding.

Is there a way to do this?
Avatar of shaydie
shaydie

Yes, Something like this:

       With oSheet.Range("B3:K7").Borders(7) ' xlEdgeLeft
        .LineStyle = 1 ' xlContinuous
        .Weight = 2 'xlThin
        .ColorIndex = -4105 'xlAutomatic
        End With
       
        With oSheet.Range("B3:K7").Borders(8) ' xlEdgeTop
        .LineStyle = 1 ' xlContinuous
        .Weight = 2 'xlThin
        .ColorIndex = -4105 'xlAutomatic
        End With
       
        With oSheet.Range("B3:K7").Borders(9) ' xlEdgeBottom
        .LineStyle = 1 ' xlContinuous
        .Weight = -4138 'xlMedium
        .ColorIndex = -4105 'xlAutomatic
        End With
       
        With oSheet.Range("B3:K7").Borders(10) ' xlEdgeRight
        .LineStyle = 1 ' xlContinuous
        .Weight = 2 'xlThin
        .ColorIndex = -4105 'xlAutomatic
        End With
ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial