Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
I have a worksheet for a product which is supplied by different suppliers.
The worksheet compares the prices and retains the lowest price in a specified cell. I want the result for the comparison to be displayed in a colour that indicates the supplier colour code |
#2
![]() |
|||
|
|||
![]()
If you have only a few suppliers, 4 or less, you could use conditional
formatting. If you have more, you would need event code, something like Private Sub Worksheet_Change(ByVal Target As Range) Const WS_RANGE As String = "B2:H10" Dim maxValue As Boolean On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then With Target maxValue = .Value = Application.Max(.Value, Cells(.Row, "B").Resize(1, 8)) If maxValue Then Select Case .Column Case 2: Cells(.Row, "A").Interior.ColorIndex = 3 'red Case 3: Cells(.Row, "A").Interior.ColorIndex = 6 'yellow Case 4: Cells(.Row, "A").Interior.ColorIndex = 5 'blue Case 5: Cells(.Row, "A").Interior.ColorIndex = 10 'green End Select End If End With End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH RP (remove nothere from the email address if mailing direct) "Tinashe" wrote in message ... I have a worksheet for a product which is supplied by different suppliers. The worksheet compares the prices and retains the lowest price in a specified cell. I want the result for the comparison to be displayed in a colour that indicates the supplier colour code |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? | Excel Discussion (Misc queries) | |||
Excel in Internet Explorer Menus quit working | Excel Discussion (Misc queries) | |||
excel stopped working | Excel Discussion (Misc queries) | |||
Sum function not working correctly in Excel (Skips Cell) | Excel Worksheet Functions | |||
Replace function not working properly in Excel 2000 SP3 | Excel Worksheet Functions |