Excel VBA Color Code List - ColorIndex, RGB Color, VB Color

Skip to content

This Excel tutorial collects the VBA color code list for reference purpose, which includes ColorIndex, RGB color, VB color.

Excel ColorIndex

VBA Excel ColorIndex Property is to set color or get color for Objects like Cell color and Shape color. ColorIndex offers 56 basic colors plus the following special numbers.

ColorIndex ValueExplanation
-4142 / xlColorIndexNone / xlNoneNo fill
-4105 / xlColorIndexAutomatic / xlAutomaticDefault color (white)

colorindex_10

Example 1: Set Cell A1 font color to redRange("A1").Font.ColorIndex = 3

Example 2: Set Cell A1 back color to redRange("A1").Interior.ColorIndex = 3

Example 3: Set Cell A1 border color to red

Range("A1").Borders.ColorIndex=3

Example 4: Get Cell A1 ColorIndexcol = Range("A1").Interior.ColorIndex

Excel RGB color

VBA Excel RGB Property is a color Property of Objects, commonly used for Cell color or Shape color.

“RGB” stands for Red Green Blue, which are known as three primary colors, which can be combined to produce other colors. For example, purple is a mix of blue and red.  In RGB Property, you need to give a value (from 0 to 255) for each color in order to mix a new color. For example, Red = 255 means the brightness of color red is 100%.

rgb color

If you try to change a color but you don’t know the color code, you can visit the websites below

http://www.ifreesite.com/color/

http://big-coronasdklua.blogspot.hk/2011/04/rgb.html

 

Example 1: Set Cell A1 font color to redRange("A1").Font.Color = RGB(255, 0, 0)

Example 2: Set Cell A1 back color to redRange("A1").Interior.Color = RGB(255, 0, 0)

Example 3: Set Cell A1 border color to redRange("A1").Borders.Color = RGB(255, 0, 0)

Excel VB color

The simplest way to apply color is using the VB color name, you don’t have to remember which number represents which color, the the color for your choice is very limited.

excel_vbcolor_10

Example: Set Cell A1 font color to redRange("A1").Font.Color = vbRed

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Comment *

Name *

Website

Categories

CategoriesSelect CategoryBook 1 – Microsoft Excel   Chapter 1 – Excel Settings   Chapter 2 – Excel Basics   Chapter 3 – Excel Built -in Function   Chapter 4 – Excel Graphs   Chapter 5 – Pivot Table   Chapter 6 – Excel PowerPivot   Chapter 7 – Excel Query   Chapter 8 – By Excel Topic      Data Conversion      Data Validation      Date / Time      Error      Excel Certificate      Excel template      References      Statistics      Tricks   Chapter 9 – Excel VBA      Unit 0 – Excel VBA Tricks      Unit 1 – Excel VBA Environment      Unit 2 – Excel VBA Programming Basics      Unit 3 – Excel VBA Built-in Function      Unit 4 – Excel VBA Object Property      Unit 5 – Excel VBA Events      Unit 6 – Excel VBA Methods      Unit 7 – Pivot Table VBA      Unit 8 – Excel Custom Function (UDF)      Unit 9 – Excel Custom Sub Procedure   Excel Graph Q&A   Excel VBA Q&ABook 2 – Microsoft Access   Chapter 1 – Access Basics   Chapter 10 – Access Error   Chapter 2 – Access Table   Chapter 3 – Access Built-in Function   Chapter 4 – Access Expression   Chapter 5 – Access Query   Chapter 6 – Access SQL   Chapter 7 – Access Report   Chapter 8 – Access Form   Chapter 9 – Access VBA      Unit 1 – Access VB Enviornment      Unit 2 – Access VBA Basics      Unit 3 – Access VBA Built-in Function      Unit 4 – Access VBA Method      Unit 5 – Access VBA Object Property      Unit 6 – Access Custom Function (UDF)      Unit 7 – Access Custom Sub ProcedureBook 3 – Microsoft WordBook 4 – Microsoft ProjectBook 5 – Microsoft OutlookBook 6 – IBM SPSS StatisticsBook 7 – Human Resources   HK Ordinance   Peoplesoft HCM   Workday HCMUncategorized

Archives

Archives Select Month May 2019  (3) April 2019  (3) March 2019  (7) August 2018  (2) June 2018  (1) May 2018  (2) September 2017  (6) August 2017  (3) July 2017  (1) June 2017  (6) May 2017  (1) March 2017  (4) February 2017  (10) January 2017  (14) December 2016  (10) November 2016  (1) October 2016  (5) September 2016  (2) August 2016  (3) July 2016  (2) June 2016  (2) May 2016  (12) April 2016  (11) March 2016  (12) February 2016  (2) January 2016  (14) December 2015  (15) November 2015  (3) October 2015  (7) September 2015  (8) August 2015  (5) July 2015  (13) June 2015  (11) May 2015  (11) April 2015  (29) March 2015  (43) February 2015  (39) January 2015  (40) December 2014  (24)

Recent Posts

  • MS Access select the first record of each group using First Function
  • Access VBA delete Table records with SQL using DoCMD.RunSQL Method
  • Add sorting in Access Table field
  • Access Case Sensitive Join Table (Inner Join, Left Join)
  • Access StrComp Function to Compare text (case sensitive comparison)
  • Access VBA import workbook to Access using Transferspreadsheet
  • Access VBA run Query or run Action Query
  • Access VBA loop through all Tables using DAO.TableDef
  • Access VBA delete Table using DoCmd.DeleteObject Method
  • Access VBA import txt using DoCmd.TransferText Method
  • MS Project shift the whole schedule
  • MS Project delete Summary Task without deleting subtasks
  • Access VBA loop through Table records
  • Microsoft Access produce Cartesian product with Cross Join
  • Solution to Access Error 3047 Record is too large
  • Access replace Crosstab Query with Expression
  • Access VBA change Query criteria using QueryDef.SQL Property
  • Quickly search email in Outlook using criteria
  • Access VBA create Query using CreateQueryDef
  • Sort Data in Access Report

Từ khóa » Visual Basic Colours