PC Review


Reply
Thread Tools Rate Thread

How do I show only the cell in a row with the greatest value?

 
 
=?Utf-8?B?U3RlcGg=?=
Guest
Posts: n/a
 
      17th Sep 2007
In Microsoft Excel I have a row with a different value in each cell and I am
looking to show only the cell that has the greatest value in that row. I
would like for all the other cells to be hidden in that row. I would also
like the program to do this automatically. Any ideas how to complete this?

Thanks!
 
Reply With Quote
 
 
 
 
=?Utf-8?B?S2V2aW4gQg==?=
Guest
Posts: n/a
 
      17th Sep 2007
Press Alt+F11 to open the VBE, click INSERT on the menu & select MODULE.

Paste the following sub into the module, modifying the row value of "A1:Z1"
to the row relevant to your worksheet. The module resides in between the
asterisks and assumes that it will be run from the worksheet you want to
highlight the max value in.

***********************************************************
Sub HighlightMax()

Dim r As Range
Dim varVal As Variant
Dim dblMaxVal As Double
Dim intColOffset As Integer

'Set the row range
Set r = Range("A1:Z1")
'Get the maximum value

dblMaxVal = Application.WorksheetFunction.Max(r)
'Capture first value in the range
varVal = Range("A1").Value

'Loop until the first blank cell is encountered
Do Until varVal = ""
If IsNumeric(varVal) Then
If CDbl(varVal) <> dblMaxVal Then
Range("A1").Offset(, intColOffset). _
NumberFormat = ";;;"
End If
End If
'increment the column offset value by 1 & get next value
intColOffset = intColOffset + 1
varVal = Range("A1").Offset(, intColOffset).Value
Loop

Set r = Nothing

End Sub
************************************************************
--
Kevin Backmann


"Steph" wrote:

> In Microsoft Excel I have a row with a different value in each cell and I am
> looking to show only the cell that has the greatest value in that row. I
> would like for all the other cells to be hidden in that row. I would also
> like the program to do this automatically. Any ideas how to complete this?
>
> Thanks!

 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      17th Sep 2007
This should do it but now you need a macro to unhide for changes. Why not
use conditional formatting instead?
Sub findmaxandshow()
With ActiveSheet
mv = .Rows(3).Find(Application.Max(.Rows(3))).Column
'MsgBox mv
.Columns.Hidden = True
.Columns(mv).Hidden = False
Application.Goto .Cells(3, mv)
End With
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Steph" <(E-Mail Removed)> wrote in message
news0CF1061-533C-4467-A5AE-(E-Mail Removed)...
> In Microsoft Excel I have a row with a different value in each cell and I
> am
> looking to show only the cell that has the greatest value in that row. I
> would like for all the other cells to be hidden in that row. I would also
> like the program to do this automatically. Any ideas how to complete
> this?
>
> Thanks!


 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      17th Sep 2007

For CF. Highlight the row header (ie 3) >format>conditional
formatting>formula is
=a3=max(3:3)
>format as desired.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Steph" <(E-Mail Removed)> wrote in message
news0CF1061-533C-4467-A5AE-(E-Mail Removed)...
> In Microsoft Excel I have a row with a different value in each cell and I
> am
> looking to show only the cell that has the greatest value in that row. I
> would like for all the other cells to be hidden in that row. I would also
> like the program to do this automatically. Any ideas how to complete
> this?
>
> Thanks!


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula to enter data of one cell based on greatest amount of anot classroomlaw Microsoft Excel Misc 1 13th Jan 2010 01:23 AM
Show actual values added instead of cell references? (=A1+A4 shows as=10+2 in cell) Naji Microsoft Excel Misc 4 30th Dec 2009 03:03 AM
Referencing text of a cell next to the greatest value in column Jrbuman Microsoft Excel Worksheet Functions 1 6th Oct 2008 09:10 PM
Function to show the greatest number of characters juliejg1 Microsoft Excel Worksheet Functions 4 12th Dec 2007 12:13 AM
format cell to show leading zeros and make cell a three digit fiel =?Utf-8?B?S3Jpc3Rpbg==?= Microsoft Excel Worksheet Functions 2 28th Jul 2006 09:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:42 PM.