Wednesday, July 7, 2010

Highlight Active Cell in MS Excel 2007

It is a very common problem that during presentation of any MS excel File we want to highlight active cell. There is some modules available but they might affect the format of your sheet.By adding this module to your sheet you can minimize this problem for example if you want to highlight the cell where you are working  as shown in figure1. 

for adding this feature to your excel sheet follow the steps Given below.

Step 1: Press ALT + F11 you will get the following screen
Step 2:Now Double Click on this Workbook and add following Module :
' Author Naushad Qamar
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Excel.Range)
On Error Resume Next
Static OldRange As Range
Static OldIndex As Integer
Const movingColor = 6
If OldRange.Interior.ColorIndex = movingColor Then
OldRange.Interior.ColorIndex = OldIndex
End If
OldIndex = Target.Interior.ColorIndex
Set OldRange = Target
Target.Interior.ColorIndex = movingColor

End Sub
Step3:Now open your worksheet you will find active cell highlighted..
Step4: Now save File as Macro enabled as shown in figure :

Working sample Download
Please Do Comment and  give suggestions, moreover if you have any query,  feel free to ask.