ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   worksheet_change (https://www.excelbanter.com/excel-programming/308062-worksheet_change.html)

aravindvin[_3_]

worksheet_change
 
Hi

I have attached the excel with code.

Based on the drop down list change in column G and H, the values i
C,D,E & F will change from 1 through 5.

Based on the numberic value in C,D,E & F, the color in it should chang


You should be able to set different colors for values = 1,2,3,4,5.

NOTE: Currenlty only cells in C are changing if the number in i
changes to 1,2, or 3. Other cells in D,E and F columns do not chang
despite the change in their values.

Let me know the solution !!!!

===================
Private Sub Worksheet_Change(ByVal Target As Range)

Dim icolor As Integer

If Not Intersect(Target, Range("C:F")) Is Nothing Then
Select Case Target
Case 0
icolor = 2
Case 1
icolor = 56
Case 2
icolor = 22
Case 3
icolor = 27
Case 4
icolor = 4
Case 5
icolor = 10
Case Else
icolor = 2
End Select
Target.Interior.ColorIndex = icolor
End If
End Sub
=================

Attachment filename: colortest v9.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=66020
--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

worksheet_change
 
See previous post.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"aravindvin " wrote in message
...
Hi

I have attached the excel with code.

Based on the drop down list change in column G and H, the values in
C,D,E & F will change from 1 through 5.

Based on the numberic value in C,D,E & F, the color in it should change


You should be able to set different colors for values = 1,2,3,4,5.

NOTE: Currenlty only cells in C are changing if the number in it
changes to 1,2, or 3. Other cells in D,E and F columns do not change
despite the change in their values.

Let me know the solution !!!!

===================
Private Sub Worksheet_Change(ByVal Target As Range)

Dim icolor As Integer

If Not Intersect(Target, Range("C:F")) Is Nothing Then
Select Case Target
Case 0
icolor = 2
Case 1
icolor = 56
Case 2
icolor = 22
Case 3
icolor = 27
Case 4
icolor = 4
Case 5
icolor = 10
Case Else
icolor = 2
End Select
Target.Interior.ColorIndex = icolor
End If
End Sub
==================

Attachment filename: colortest v9.xls
Download attachment:

http://www.excelforum.com/attachment.php?postid=660204
---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 11:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com