ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer Science & Programming»
  • Programming Languages

VBA: How to Apply and Change Excel Border Styles

Updated on September 4, 2012

A border is an outline around the contents of a cell.

To create a border in Excel:

  • Select a single cell or range of cells
  • Right Click
  • Select Properties
  • Click the borders tab

  • Click the desired style of line to the left.
  • Click the desired location using the buttons around the preview box.

Note: Each border location with a range can have a unique line style. Simply select the desired line style prior to click the location button.

Excel Border Locations

Borders in Visual Basic

The basic structure of code for inserting borders from VBA is as follows.


For Example:

Range("A1").Borders(xlEdgeBottom).LineStyle = xlDouble

Visual Basic Border Location Options

Visual Basic Linestyles

Ready to Proceed

In the next module you will learn to work with worksheets in Excel and VBA. Click here to proceed.


    0 of 8192 characters used
    Post Comment

    No comments yet.