Thursday, 28 August 2014

How to Apply Border Around or Outside Border to the Selection in Excel VBA Macro

Excel VBA Macro to Apply Border Around or Outsider Border to the Selection
The following simple macros shows the setting borders to the section of cells. Sub BorderAround()

Selection.BorderAround , ColorIndex:=xlAutomatic, Weight:=xlMedium

'For Thin Border
'Selection.BorderAround , ColorIndex:=xlAutomatic, Weight:=xlThin
'For Thick Border
'Selection.BorderAround , ColorIndex:=xlAutomatic, Weight:=xlThick
End Sub

Example :


--------------------------------------------------------------------------------------------
Macro to Change the Border Styles :


Sub CellsBorderStyles()

Selection.Borders.LineStyle = xlContinuous




Selection.Borders.LineStyle = xlDouble




End Sub

Thanks,
TAMATAM
        [ BI-Analyst ]

No comments:

Post a Comment

Follow Me by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts