Thursday, August 28, 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

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.

Featured Post from this Blog

How to compare Current Snapshot Data with Previous Snapshot in Power BI

How to Dynamically compare two Snapshots Data in Power BI Scenario: Suppose, we have a sample Sales data, which is stored with Monthly Snaps...

Popular Posts from this Blog