inside thin and outside
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

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

resolvedResolved · High Priority · Version 2003

replyReply Thu 17 Mar 2011, 17:19Delegate Brian said...

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

For upcoming training course dates see: Pricing & availability

replyReply Thu 31 Mar 2011, 08:46Trainer Anthony said...

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

replyReply Thu 31 Mar 2011, 09:41Delegate Brian said...

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

 

Please browse our web site to find out more about
microsoft excel training courses and other Microsoft training courses.

Excel tip:

Shortcut for accessing recently opened files

To get into recently opened Excel files without using your mouse, hold down Alt + F to open the File menu.

Recently opened files are listed down the bottom of the File menu - type in the number next to the file you wish to open and it should appear on your screen.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard