Highlight Excel cells while entering Data

When you enter large amount of data into MS Excel worksheet cells or have difficulty navigating the Excel cells, you can have the cell highlighted before you start entering data. This helps to reduce errors during data entry. This can be specially useful for senior citizens or visually handicapped persons.
One of our website visitors had this exact query. The solution to highlighting Excel cells while entering data can be easily found using Excel VBA. The macro code is simple as shown below:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveSheet.Cells.Interior.ColorIndex = xlNone
Target.Interior.ColorIndex = 43
End Sub

What does the vba code accomplish:
It colors the excel cell in which you want to enter the data. Once you leave the cell the original cell color (white) is restored and the next selected cell gets highlighted.

If you not sure which color will appear when you use a color index number, you can visit this excellent website for colorindex numbers and the relevant color.

Now watch the MS Excel training video below to see how the code is written and implemented:

2 thoughts on “Highlight Excel cells while entering Data


    Hi sir.
    I have one doubt in excel. Suppose in excel two sheets are there,
    sheet1- column A employee codes are there , column b employee names are there

    Sheet 2-. If I put an employee code,I would like a script that replace automatically when pressing enter or changing cell, found the data against employe code ffom sheet1. I hope you can help me

    Thank you


    Sir, the code you have made is amazing! But only one problem with the worksheet here that If I have have colored some cells in the worksheets…..so all the cells become white after using this code……so the cells I have colored should be kept as it is. So please modify this code in that way so that it will be helpful for all………thanks sir


Leave a Reply

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