Hi Arvind,
I looked at your workbook, and because you do not give a
description in text of what you want, I will have to describe
in text what you wanted, but more directed to what this
Event Macro will be doing.
Bar Graph composed of cells, for a severity ranked by color
Your spreadsheet has entry in columns 8 an 9 (H & I)
Column H provides a number 0 to 4 (though you white out 5)
Column I provides a number 1 to 5 to create a color (colorindex used)
Columns 2:6 are colored from the left for a length of what is
in Column H, for a color derived from Column I (col 9).
ColorIndex values can be found in
http://www.mvps.org/dmcritchie/excel/colors.htm
1=Black, 2=White, 3=Red, 6=Yellow, 10=dark Green, 46 Orange
Use of Event macros can be found in
http://www.mvps.org/dmcritchie/excel/event.htm
Install by rightclick on the worksheet tab, view code
Rather than using .clear the interior.colorindex is set to white
which clears out grid lines, which it appears you did not want to see.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column < 8 Or Target.Column > 9 Then Exit Sub 'H & I
If Target.Row < 2 Then Exit Sub
Dim R As Long, I As Long
R = Target.Row
If Not IsNumeric(Cells(R, 8) & Cells(R, 9)) Then Exit Sub
I = Application.Choose(Cells(R, 9).Value, 1, 3, 46, 6, 10)
Intersect(Rows(Target.Row), Columns("B:F")).Interior.ColorIndex = 2
Range("B" & R & ":" & Cells(R, 1 + _
Cells(R, 8).Value).Address(0, 0)).Interior.ColorIndex = I
End Sub
By not describing what you want you put an extra burden on
anyone who wants or tries to help. By not doing this effort yourself
you imply to others that you don't really care enough to describe
the problem in plain text so why should anyone try to help you.
And I think the lack of using your full name when corresponding
also indicates a further disregard to others in the newsgroup,
and in your own contribution.
If your 38KB file were actually an attachment it would have made
your posting over 80K. Fortunately it is not an attachment but
is a file on a website. But for anybody to see what the question
is you make them look at the file, and the newsgroup archives
http://google.com/advanced_group_search?q=group:*Excel*&num=100
will not show what the question is so it would not help others with
similar questions who were willing to search archives for something close to what they want. Also see
http://www.mvps.org/dmcritchie/excel/xlnews.htm
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages:
http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page:
http://www.mvps.org/dmcritchie/excel/search.htm
JE McGimpsey said:
Sorry - I don't open unsolicited workbooks (virii, for one thing, and
long experience that people usually attach workbooks because they're too
lazy to clearly articulate their request, for another).