Category Archives: Excel

No Thumbnail

Excel VBA, Create Border

In this article I will explain how you can make basic borders using VBA for Excel. Each range of cells can accept up to 8 different types of borders: Left edge (xlEdgeLeft) Top edge (xlEdgeTop) Bottom edge (xlEdgeBottom) Right edge (xlEdgeRight) Inside vertical (xlInsideVertical) Inside horizontal (xlInsideHorizontal) Diagonal down

No Thumbnail

Excel VBA, Open a Closed Workbook

I recommend readers to read the article below to further familiarize themselves with the process of automation: Excel VBA, Get Data From Another Workbook Through Automation – Basics: The code below will open the workbook located in the path D:StuffBusinessTempTempFile.xlsx”: Sub Example1() Dim objWorkbook As Workbook Set objWorkbook = Workbooks.Open(“D:StuffBusinessTempTempFile.xlsx”)

No Thumbnail

Excel VBA, Apply Fill Pattern to Rows

Jump To: Apply Fill Pattern to Row Modify Row’s Fill Pattern Color – Apply Fill Pattern to Row: The following line of code applies the Reverse Diagonal Stripe fill pattern to row 3: Rows(2).Interior.Pattern = xlDown Note: The intellisense may not work while working with the Rows member.

No Thumbnail

Excel VBA, Get Vertical Alignment (Sample Code)

In this article I will provide an example on how to find cells with a specific vertical alignment. You can download the code and file related to this article here. The user selects the desired vertical alignment to find from a drop down list: After pressing the run button

No Thumbnail

Excel VBA, ColorConstants

The class ColorConstants contains a list of color codes. Although this list is very limited but often it is enough to get the job done. If you require more specific colors please see Excel VBA, Color Code. In the example below the color code associated

No Thumbnail

Excel VBA, Apply Fill Pattern to Column

Jump To: Apply Fill Pattern to Column Modify Column’s Fill Pattern Color – Apply Fill Pattern to Column: The following line of code applies the Reverse Diagonal Stripe fill pattern to column B: Columns(2).Interior.Pattern = xlDown Note: The intellisense may not work while working with the Columns

No Thumbnail

Excel VBA, Vertical Alignment

In this article I will explain the different vertical alignment formattings applicable to cells and ranges. I have also provided the VBA code required to apply them. Jump To: Top, xlTop Center, xlCenter Bottom, xlBottom Justify, xlJustify Distributed, xlDistributed – Top, xlTop: The following code will top align the text in cell “A1”: Range(“A1”).VerticalAlignment = xlTop

vba color change fill example blue

Excel VBA, Cell Fill Color

In this article I will explain how you can set and get the fill color of cells using VBA. There are many times you may need to set the background colors of certain cells based upon a condition. Using conditional formatting is not always feasible as