Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

inside thin and outside

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Inside Thin and Outside Thick Borders CurrentRegion

Inside Thin and Outside Thick Borders CurrentRegion

ResolvedVersion 2003

Brian has attended:
Excel VBA Intro Intermediate course

Inside Thin and Outside Thick Borders CurrentRegion

Hi

Please can you advise how you go about making the currentregion inside borders to be think without the outside border of the currentregion to have thick borders.

The macro record code seems to have every edge of the border and presume there is a neater solution using the with command.

Thanks

Brian

RE: Inside Thin and Outside Thick Borders CurrentRegion

Hi Brian, thanks for your query and apologies for the delay. My attempt with the macro recoder yields the following which I would tidy up into one With expression. You can see you need to be specific about which borders to format, and in the case of borders I would code the default settings to "format over" any formatting already on the sheet. Here's the code:

Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
End Sub

Hope this helps,

Anthony

RE: Inside Thin and Outside Thick Borders CurrentRegion

Hi Anthony,

I have managed to find out the code online and thought i'd update the post for anyone looking in.

With Selection
.Borders.Weight = xlThin
.BorderAround Weight:=xlThick
End With

Thanks

Brian

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Quickly Adding New Worksheets

Want to place a new Excel worksheet before current worksheet. Use keystroke SHIFT+F11

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.