Get Cell Color Excel Vba

Need more help? You can always ask an expert in the Excel Tech Community , get support in the Answers community , or suggest a new feature or improvement on Excel User Voice. Often there are times when I want to match a specific color that falls outside the current spreadsheet's Theme Color palette. Excel VBA Online Training VBA stands for Visual Basic for Applications, an event-driven programming language from Microsoft that is now predominantly used with Microsoft Office applications such as MS-Excel, MS-Word, and MS-Access. I will usually recommend NOT using VBA. Find: Get Real Last Cell: 7. For versions of Excel lower than 2007: the number of colors is limited (the closest available color to the RGB values will be used). Description:This module will remove extra spaces from both sides and from inside the selected cells. When we have colors on our sheets data and want, for instance, to count how many “red” words we have on our sheet, that is not possible because there is no formula in Excel to check for font colors. 6 (8,568 ratings) Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately. Macro Examples. Color Palette and the 56 Excel ColorIndex Colors. Place three command buttons on your worksheet and add the following code lines: 1. I want to develop some vba code that would place values in an adjacent cell that is triggered by the font color of the trigger cell. This article describes the formula syntax and usage of the CELL function in Microsoft Excel. These shapes can be used for various purposes and you can easily change its properties like the color or the size etc. Formatting cells and fonts in VBA – introduction Cells as well as other elements of the Excel spreadsheet can be formatted from the VBA code level. Excel, Access, PowerPoint and Word Help > Forum > Zone of the Champions > Rick Rothstein's Corner > Get Displayed Cell Color (whether from Conditional Formatting or not) If this is your first visit, be sure to check out the FAQ by clicking the link above. Count unique distinct cells by cell font properties (font color, cell color, bold or italic) Custom function in cell D3: =CountC(A1:A20,C3) The user defined function matches the font properties in cell C3 with each cell in cell range A1:A20, then counts unique distinct values in those matching cells. There is not an Excel function which returns a color value and it is necessary to create a user-defined function using VBA. Excel VBA Macros : How To Change Text In A Cell Create A Module. - Patrick Fromberg Jul 23 '14 at 13:38. All of the addresses within the dialog box are selected. Use row and column index to reference cell: 4. Changes can also be made with a macro to simplify changes. xls spread sheet and you will be able to see the issue. 70+ MUST KNOW EXCEL SHORTCUT KEYS: Download the pdf from our Excel training page UNDERSTAND & FIX EXCEL ERRORS: Download the pdf from our Excel training page Learn how to fix these errors: #DIV/0!, #N/A!, #NAME?, #NULL!, #NUM!, #REF! & #VALUE! See font colour above for different ways of specifying colour. Examples of the Excel Cell Function. eMail_date. Excel supports more than 16 million colors in a cell; hence you should know how to set the exact color in a cell. Any questions? Just leave us a comment. looping through a worksheet range using a For/Next loop. ListObjects(1). Square Cells in Excel If you have done much drawing using Excel's drawing tools , you may have figured out that you can use the cells as a grid. Color cells with the same value in a Range, worksheet or all worksheets. The named formula = GET. The Worksheet range used by Excel is not often the same as the Excel last row and column with values. Instead of modifying selRow & solCol from VBA, we use two formulas =cell("row") for selRow & =cell("col") for selCol. The function requires 3 numbers from 0 to 255 [e. ColorIndex and the background with. Entering a value in the next empty cell: 9. Here's the Excel colour picker as it appears when requested from the Font Color toolbar button. g if a cell value is " excel items "then after running the macro it will become "excel items". Want to change the color of something, but leave it to the user, which color exactly. Excel Color Index, coloring of fonts, cell interiors. The Formula property represents the formula in a cell. count or sum cells in Excel based on cell background color. com/public/qlqub/q15. By adding a few lines of VBA code to your spreadsheet, you can automate the process and make Excel paint cell backgrounds gray automatically when you highlight them. I need to add new sheets in excel based on unique cell values of a particular column. How to Count Cells with Text in Excel Last week one of my readers asked me for a simple formula which he can use to count cells with text. But following the release of Excel 2007, sorting became complicated. Excel VBA Clear Cell: Step-by-Step Guide and 5 Examples to Clear Cells with Macros By J. Specially, while preparing reports or dashboards, we change the backgrounds to make it clean and get. VBA - Get font color Function. VBA font color is used. Enter the following code into VBA. Offset(2,3). VBA also has the function by which we can change the color of cell, fonts and we can even bold the characters as well.  There are also times when I want to match an Excel color so I. [moth_social] We often get asked if we can count colored cells on a worksheet, and yes you can. This Excel VBA macro selects a cell in a table on the active sheet. IsText(rng) Then i = i + 1 End If. WorksheetFunction. This is a basic feature that works right out of the box however, if you want to lock cells based on color, you need a little VBA script to do that. Using VBA you can choose to create borders for the different edges of a range of cells: xlDiagonalDown (Border running from the upper left-hand corner to the lower right of each cell in the range). In other words, this statement changes the cell's background to middle gray. Want to change the color of something, but leave it to the user, which color exactly. To do this, you can use RGB (Red, Green, Blue) function in VBA to set the color of a cell. ColorIndex = 8 'Change the background color of Entire Row. Example 5: Get the color code of a cell. Change color to different cells based on another cells text. Excel VBA Check if Cell is Empty: Step-by-Step Guide and 4 Examples to Check if Cell Range is Empty with Macros By J. We need to follow the below steps to launch VB editor. Excel Course. Entering a value in the next empty cell: 9. This is a basic feature that works right out of the box however, if you want to lock cells based on color, you need a little VBA script to do that. Thanx Dave, have followed the above advice however the number is still showing in the cell. calculate so that Excel would update the selRow & selCol values with latest row & column (ie target). Read/write Variant. This post will guide you how to count and sum cell by background color in excel. So, these were the methods to find merged cells in excel. Free VBA Tutorial If you are new to VBA or you want to sharpen your existing VBA skills then why not try out the The Ultimate VBA Tutorial. The point is, though, that we can manipulate the cells on a spreadsheet by using just a number from our loop and the Cells property. I’ll be showing a few of the useful examples of it below. That is, Excel tabs among the cells in your simulated form. Also the above code does not count the cells where cell color is manually changed by user. Macros are small but very powerful VBA programs in Microsoft Office software. I'm trying to write a script to automatically generate an excel sheet. The basic syntax looks like this: Range("A1"). First, it often requires making the cell volatile and second, users has to activate macros - which are deactivated per default due to security issues. Example #2 – Select Cells using Range Object in Excel VBA Now by recording the macro, we get to know to select the cell we need to use the object RANGE. The problem with many spreadsheets is all the cells look the same. Color doesn't return the color value of a conditionally formatted cell. Set up your cell referencing: Absolute referencing - if your calculations come from a stationary cell like "A3" etc. I use the FOR EACH VBA construct for looping. Sep 07, 2018 · The function keys on keyboards don’t get the love they used to, but depending on the app you’re running, they can still be quite handy. Hide and unhide the Ribbon; Activate a Ribbon tab in two different ways. When we have colors on our sheets data and want, for instance, to count how many “red” words we have on our sheet, that is not possible because there is no formula in Excel to check for font colors. Color = ContentFontColor 'Add fill color to the cells Contents. For example, you may want to have one file of all your receipts with date, account, category, provider, product/service, and cost entered one line at a time, as they occur—an instance of evolving accounting rather than static accounting. Would be great it this function would work the same as any other Excel function. SpecialCells(xlCellTypeBlanks). Color cells with the same value in a Range, worksheet or all worksheets. Excel supports more than 16 million colors in a cell; hence you should know how to set the exact color in a cell. Macros are small but very powerful VBA programs in Microsoft Office software. Appearance can play a huge factor in the professionalism of your spreadsheet's presentation. In this article you will learn how we can use VLOOKUP by a cell background color. RGB(234,232,98)]. Also the above code does not count the cells where cell color is manually changed by user. Value + 2 'Add 2 to retrieve the column that contains the definiton. This page describes VBA functions you can use to work with colors on worksheets. Entering a value in the next empty cell: 9. Change Cell Background Color with Interior. You could set the font color of the entire cell to be red via VBA, but not just certain characters. This will allow you to use the value from a cell in a macro in many different ways and you will also learn how to output the value back into the spreadsheet. I need formula without VBA code. To make it easier to see the active cell, you can add a macro to your Personal Workbook, following the steps below. VBA - Get font color Function Published by jppinto on 2. Excel, Access, PowerPoint and Word Help > Forum > Tips, Tricks & Downloads (No Questions) > Excel Tips and Tricks > Excel Macro Functions (GET. I am trying to fill an Excel cell array with the output of a function defined in my Excel Builder Component. You can use. Here’s a couple ways to change the background color of cell A1. =CELL("color",cell) It might just be that I don't know what this means in Help: "color" --> 1 if the cell is formatted in color for negative values; otherwise returns 0 (zero). 4 part section >> A TreeView Project. Don't know how well it works, it may be buggy, but I did get it to work when I tried, as shown in the GIF. Get an overview of the below table, how the color of cell B1 will change: See how the Cell B1 text will change color based on the values of cell B8. You can do conditional formatting in Excel using VBA. This is a 3-part video series and you can also download the file that contains the code. It is based on request from one of LEM reader who wants to know, How to insert a picture in excel sheet using VBA code It is a very simple one liner code to insert a picture in Excel using vba code. Applying VBA in Excel is the easiest and a fun thing. It lets me edit the unprotected cells now, but it grays out just about every control in the home tab ribbon. First you check if num1 is bigger or equal than 50: If num1 >= 50 Then grade = "B" Cells(1, 2). The background color will change dependent on the cell's value. Summary: Learn the difference between using Range() and Cells() when referring to ranges with Excel VBA. Change Cell Background Color with Interior. [moth_social] We often get asked if we can count colored cells on a worksheet, and yes you can. Customizing the Format It is up to you whether the row is highlighted by bolding the font, changing the fill color or something entirely different. Here is the way that can be done using VBA using the Characters property Sub Color_Part_of_Cell() 'Print ActiveCell. VBA Excel – Cells, Ranges and Offset : Cells. Enjoy! VBA Code:. The following code line sets the background color of cell A1 to 'No Fill'. When the value of cell B8 changes, the text color of cell B1 also changes. Cells(11, 2). To perform this, click on the Visual Basic under the Developer tab and insert the below code in there. Agreed, VBA is probably the route to go with this one. Latest update on November 6, 2012 at 08:19 AM by Jean-François Pillou. Description: It is an interesting feature in excel, we can change background color of Cell, Range in Excel VBA. I will also discuss about difference between Inserting a picture in Excel and Embedding a picture in Excel Sheet using Excel VBA. Macro Example Sub SelectingCellInTable() ActiveSheet. The Basics VBA Tip: Format Characters in a Cell. VBA Color Index is a function by which we can change the color of the cell or text which is located in the Home menu under the Font section. I've tried the following: sheet[rowIndex, colIndex]. From Code group, select Visual Basic Click on Insert, and then Module This will create a new module. In this article, you will learn how to get color of the cell using VBA code. The Excel VBA Color on the other side allows you to set any color to any Excel Cell property using the VBA RGB function. Excel VBA Color Index. There is no built-in feature that can determine the color index of a cell, but, in this article, I introduce some VBA codes to solve this job in Excel quickly. 09 / Tags: COUNTIF , VBA When we have colors on our sheets data and want, for instance, to count how many “red” words we have on our sheet, that is not possible because there is no formula in Excel to check for font colors. You can use. In addition to learning the IF THEN statements and how to loop through cells, you also learn how to quickly get the color code of a specific cell so you can refer to it in your Excel. This article describes the formula syntax and usage of the CELL function in Microsoft Excel. Go To "Insert" Select "Module" from the menu; Find your module in the Project window; If needed, expand the "Modules. There are a number of ways you can change the cell value in excel using VBA. The above code will get us a diagonal line form cell A1 to cell E5, which each cell filled with the numbers 1 to 5. the source from cpearson has the vba to count the conditional formatting that you are looking for. Next, enter the following SUMIF() in E2 and copy it to the remaining cells:. Excel VBA Color Index: Complete Guide to Fill Effects and Colors In Cells Nov 05, 2017 by Archana Oswal in Color. Remember to save your file in either XLSM or XLAM format to save your VBA code. Color Palette and the 56 Excel ColorIndex Colors. Save the file as macro enabled workbook. In Excel a Worksheet Change Event is a trigger for a macro when a cell or group of cells change. Now write on your own, type the word RANGE and open parenthesis. Have a look at the example. Instead we can create our own VBA Function to get the font color. Keywords Microsoft Office, Office, Excel, Microsoft Excel, read from Excel, cell color, cell format, Excel cell color, Excel cell format. If you need to retrieve more than one cell/range then, instead of using this code multiple times, you’d be best to build an array of the values within a single call and return an array (or collections, …) so you only make one call to Excel to open the file. These shapes can be used for various purposes and you can easily change its properties like the color or the size etc. Changes can also be made with a macro to simplify changes. In this post, we will look at how we can control Word from Excel even though we don’t know any VBA code for Word. I will also discuss about difference between Inserting a picture in Excel and Embedding a picture in Excel Sheet using Excel VBA. Color = vbRed End Sub. I've added the tags for you this time; please be sure to use them in future posts when needed. When we have colors on our sheets data and want, for instance, to count how many “red” words we have on our sheet, that is not possible because there is no formula in Excel to check for font colors. Finding the last used row, column, or cell is one very common task when writing macros and VBA applications. Excel provides no support for sorting a range based on the cells' colors. It lets me edit the unprotected cells now, but it grays out just about every control in the home tab ribbon. You can achieve this by applying conditional formatting and selecting a Rule Type for your range of values. Cells(1, 1). And, that’s why we have a macro code to apply color to all the blank cells from a selected range. How to use VBA to sum Excel values by fill color. There are a number of ways you can change the cell value in excel using VBA. transposes the values of a group of cells in a worksheet: 10. With the help of sample code you'll understand when to use Range() and when to use Cells(), how to use them together, and also get bonus tips for working with ranges. In Excel a Worksheet Change Event is a trigger for a macro when a cell or group of cells change. You could count cells using a combination of conditional formatting, filters and the SUBTOTAL function, but I want to show you how writing a UDF (user defined function) can let you count, sum and average colored cells, in the same function. Ex: in VBA Excel when you say Cells(2,3) which means, in 2 nd row and in 3 rd column means “C2”. We can do anything in VBA and apply that to Excel. The video offers a short tutorial on how to change cell color in Excel if value is changed using VBA. I use the color index in this example to give all cells with "ron" the color 3 (normal this is red). Hi, Is there a way to have a 3 color gradient fill in Excel cells? 2 colors are easy, but I couldn't find an option for 3 color. Want to change the color of something, but leave it to the user, which color exactly. We don't care about the cells with no color assigned (-4142). They can help us complete some repeated tasks automatically. Formatting Text (Cell Contents) Partially using Excel VBA Sometimes, you need to differentiate some parts of text in an Excel cell. This will add line shapes above, and to the left of the active cell. Referring to Ranges in VBA. Don't know how well it works, it may be buggy, but I did get it to work when I tried, as shown in the GIF. Caution - This function does not update automatically when the interior color of a cell changes. Example 5: Get the color code of a cell. Value = grade Imagine if num1 equals 49, then the next ElseIf will get executed. The code acts as a toggle between converting cells to white and removing the background of white filled cells. The Basics VBA Tip: Format Characters in a Cell. The first way is to set each format using a separate code block. Excel supports more than 16 million colors in a cell; hence you should know how to set the exact color in a cell. transposes the values of a group of cells in a worksheet: 10. How To Import Your Outlook Emails Into Excel With VBA. Cells(3, Destination_System). Refer to ranges. User defined function. To use this code in your Excel file, follow below steps: 1. We can use this function when we have to get the value from a table on the base of cell background color is place of lookup value. if equal set background color to MS Access 2010 change MS Excel cell background color using VBa 50% OFF* an Expert Office ® subscription. If I have a data of 1000 rows and in that the 1st column contains the month names. We will use this function to determine the background color. Aka 'color' if you're from the U. White/default color has a specific color code, so you want to check if the color code is different than white code then do any action. The video offers a short tutorial on how to change cell color in Excel if value is changed. tutorialspoint. What’s that? You didn’t know that 8421504 is middle gray? For some insights into Excel’s wonderful world of color, see the nearby sidebar “A quick-and-dirty color primer. By adding a few lines of VBA code to your spreadsheet, you can automate the process and make Excel paint cell backgrounds gray automatically when you highlight them. Click Close. colorindex To change a cells background color using VBA you can use the interior. It can be color, column / row position, width, format or a number of other attributes (see below). Is it possible to use the GET. How To Delete Cell Content In Excel With Simple VBA October 29, 2011 by Barbara Do you do the same thing over and over again in Excel, want to get automating with some simple macros and VBA, here is a great one to get started. The only problem with VBA if i need to run macro with another input and position of N/A cells changes, this macro does not rewrite the color. Count, "A"). ColorIndex = 30 etc Here is the entire list of colors you can use: RSS Feeds Submission Directory. Square Cells in Excel If you have done much drawing using Excel's drawing tools , you may have figured out that you can use the cells as a grid. Thank you for the VBA Code to colour the bar chart by cell colour (source). Macro Example Sub SelectingCellInTable() ActiveSheet. Here is the way that can be done using VBA using the Characters property Sub Color_Part_of_Cell() 'Print ActiveCell. The video offers a short tutorial on how to change cell color in Excel if value is changed using VBA. ColorIndex and the background with. client = ActiveSheet. Worksheets is a collection of Worksheet objects. Function ColorIndex(CellColor As Range). When you receive a sheet with multiple colorful cells as below screenshot shown, in some cases, you may want to identify the background color index of these color cells. Then stops blinking when that cell has a valid value in it. These solutions work both for cells colored manually and with conditional formatting. Calling and using the color picker with VBA Posted on February 5, 2018 December 27, 2018 by Excel Off The Grid When building Excel-based tools and applications it is often useful for the user to select a color. count or sum cells in Excel based on cell background color. The CELL Formula has two parts: CELL (attribute_type, cell_reference) attribute_type specifies the attribute that you are trying to find. Use this macro to highlight the active cell on an Excel worksheet. Read More: How to Add or Remove Cell Borders in Excel. Description. The Font object has many properties like the Color property and the Bold property. If you need to compute the total for certain cells based on their font or fill color, you may have noticed that Excel formulas operate on stored values, not displayed values. transposes the values of a group of cells in a worksheet: 10. Go To “Insert” Select “Module” from the menu; Find your module in the Project window; If needed, expand the “Modules. Enter the following code into VBA. Have a look at the example. Press Ctrl+A. Save the file as macro enabled workbook. Is there a way using VBA that 1) I select a cell or range of cells, 2) click a control which will trigger VBA to apply a permanent fill color to those selected cells? We want to use this for a timekeeping calendar completed in Excel. You can do conditional formatting in Excel using VBA. We will use this function to determine the background color. This allows you to see the grid lines in the worksheet. Summary: Learn four different ways to find the last cell, row or column in a worksheet using Excel VBA. It’s a very simple code. I'm trying to clear the color from a cell in an existing Excel file, and I can't find a way to do it without setting the cell background to white, which isn't the same as selecting no fill from the Excel fill color menu. sapConnection. Cell which is an old Macro 4 command. The VBA ColorIndex is a property used to assign a certain color to some elements, such as a cell’s background or its text, from a palette of 56 pre-defined colors, via VBA programming. The above is a small part of a VBA Excel macro that I wrote for a stock application. Excel Vba Commands List Pdf. eMail_date. Well, there are some VBA solutions around, but today I’d like to look at a solution that’s fairly straight forward, and uses the tools already available in Excel. Vba To Change Font Color In Cells Based On Value - Excel I'm using some basic code below in an on Workbook Open event to format cells with a value less then 2 and less than 1 with a particular color. Here's a couple ways to change the background color of cell A1. The code acts as a toggle between converting cells to white and removing the background of white filled cells. Add colored borders We will now create a macro that adds a border to the active cell using ActiveCell. Description: It is an interesting feature in excel, we can change background color of Cell, Range in Excel VBA. Using VBA you can choose to create borders for the different edges of a range of cells: xlDiagonalDown (Border running from the upper left-hand corner to the lower right of each cell in the range). How to Change the Color of Cell upon Selection? In this article, you will learn how to change the color of the cell after selecting any color. htm Lecture By: Mr. This will allow you to use the value from a cell in a macro in many different ways and you will also learn how to output the value back into the spreadsheet. During the loop, we check the value in the cell and change the background color of the cell depending on the value. CELL can get things like address and filename, as well as detailed info about the formatting used in the cell. In order to check the cell background color, you have to use VBA. 'ActiveSheet is the sheet calling the Macro / Cells(x, y) refers to the row, column in the spreadsheet ' Destination_System = ActiveSheet. i want formula which should count if the cells font is in certain color. Function InteriorColor(CellColor As Range) Application. February 9th, 2013 | Tags: ColorIndex, Excel VBA Examples | 3 Comments. Aka 'color' if you’re from the U. There are a number of ways you can change the cell value in excel using VBA. tutorialspoint. You can also change the colour by replacing the number 28 by some other number between 0 - 56. The instructions in this article apply to Excel 2019, Excel 2016, Excel 2013, Excel 2010, Excel 2019 for Mac, and Excel 2016 for Mac. Actually, he was trying to figure out which is the best method to use. Excel library. Color = ContentFillColor 'Add. Excel VBA - Change Sheet Tab Color Excel VBA - Hide and Unhide Sheets Excel VBA - Sheet Protection. The Font property of the Range object in Excel VBA gives access to a lot of other properties. VBA to Count Cells with Text. I’ll be showing a few of the useful examples of it below. ColorIndex = 30 etc Here is the entire list of colors you can use: RSS Feeds Submission Directory. Get Cell Color Function Function returns the active cell interior or font color index, regardless of whether it was set by regular or Conditional Formatting. When a new value is entered into a worksheet cell, Excel will recalculate all the cells that refer to it. To use the this Custom Function type =InteriorColor(A1) into any cell. I have previously submitted a similar post on how to find and highlight duplicate in Excel using VBA. Color = Color. With improvements to the last few versions of Excel I see people using colors in cells more, the ability to filter by color adds to the benefit of using fill colors. Because the Personal Workbook opens automatically when Excel opens, this macro will run in any workbook that you. Place three command buttons on your worksheet and add the following code lines: 1. Related Training: Get full access to the Excel VBA training webinars and all the tutorials. Insert a new module to the project. This Excel VBA macro selects a cell in a table on the active sheet. Sub ColorBlankCells() Dim rng As Range Set rng = Selection rng. Use the corresponding checkboxes to activate properties. Submitted by ravisagar on Sun, 02/10/2008 - 16:42 How to change the background color of entire row in Excel using VBA code - Conditional 2008-02-10T16:42:21+00:00 My friend Vinod gave me a problem to change the background color of entire row to Red and also to change the font to bold. colorindex To change a cells background color using VBA you can use the interior. How to get the sum of colored cells in the current worksheet. The above is a small part of a VBA Excel macro that I wrote for a stock application. Any questions? Just leave us a comment. mentioned earlier, the following tutorial lessons are designed to get you started Of use lessons out vba excel tutorial pdf free with free-to free the im Jan 24, 2010. Place three command buttons on your worksheet and add the following code lines: 1. The formula is an Excel VBA function. VBA font color is used. This example color all cells in the range Sheets("Sheet1"). See the comments in the code if you want to use all cells on the worksheet. I've tried the following: sheet[rowIndex, colIndex]. Sub ColorBlankCells() Dim rng As Range Set rng = Selection rng. Thank you for helping us maintain CNET's great community. Examples of the Excel Cell Function. It will change the background colour of all the merged cells to "Aqua". If the macro is writing values into the worksheet, VBA will need to wait until the worksheet is done recalculating each entry before it can resume. How to format an Excel file using C# When programming with Microsoft Office Excel, you can interact with the objects provided by the Excel object model. ColorIndex = 8 ' Change the background color of Cell A1 Range("A1"). Note: Print this page, open Excel and a open a new workbook. From_date – This cell will allow the user to input a From Date so that only emails received (and in our Sales folder) after this date are returned. interiorIndex. Actually, he was trying to figure out which is the best method to use. ” Excel VBA: The Formula property. Color cells with the same value in a Range, worksheet or all worksheets. Check cell background color. I has an excel table with a range of (B12:ZZ74), the Column B must be for symbols and Column C for numeric values, Column D for symbols and Column E for numeric values so on until the end of the range. ) Get the Free eBook. It lets me edit the unprotected cells now, but it grays out just about every control in the home tab ribbon. With the help of sample code you'll understand when to use Range() and when to use Cells(), how to use them together, and also get bonus tips for working with ranges. The below VBA method can help you set a cell color equal to another in Excel. In this article, you will learn how to get color of the cell using VBA code. Characters(2. In VBA we have two ways of applying the color, the first one is by using "color" property and the second one is using "VBA color index" property. Click on Developer tab.