Link to home
Start Free TrialLog in
Avatar of Frank Freese
Frank FreeseFlag for United States of America

asked on

VBA borders around all cells

Folks,
I am looking for a way to add borders around all cells using VBA for the range K3:L13. What I tried below doesn't seem to even give me the bottom edge.

Range("K3:L13").Borders(xlEdgeBottom).LineStyle = XlLineStyle.xlContinuous

Open in new window

SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

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
SOLUTION
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
When working with multiple rows at the same time you have to set the inside horizontal border:

Range("K3:L13").Borders(xlEdgeBottom).LineStyle = XlLineStyle.xlContinuous
Range("K3:L13").Borders(xlInsideHorizontal).LineStyle = XlLineStyle.xlContinuous

Kevin
SOLUTION
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
ASKER CERTIFIED SOLUTION
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
Avatar of Frank Freese

ASKER

Folks,
I wrote this and it worked! Surprised even myself.

Dim rng As Range
    Set rng = Range("K3:L13")
    With rng.Borders
        .LineStyle = xlContinuous
        .Color = vbBlack
        .Weight = xlThin
    End With

In fairness to all I'll distribute the points the points equally. I appreciate your response
thank you to all