Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Tinashe
 
Posts: n/a
Default working with excel

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   Report Post  
Bob Phillips
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
Excel in Internet Explorer Menus quit working Phil Mullins Excel Discussion (Misc queries) 0 April 8th 05 10:15 PM
excel stopped working Steve Excel Discussion (Misc queries) 0 January 13th 05 04:07 AM
Sum function not working correctly in Excel (Skips Cell) Tony Excel Worksheet Functions 5 November 29th 04 11:52 PM
Replace function not working properly in Excel 2000 SP3 rgbytg Excel Worksheet Functions 5 November 11th 04 03:44 PM


All times are GMT +1. The time now is 07:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"