Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 110
Default How do I show only the cell in a row with the greatest value?

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!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default How do I show only the cell in a row with the greatest value?

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!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default How do I show only the cell in a row with the greatest value?

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

"Steph" wrote in message
...
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!


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default How do I show only the cell in a row with the greatest value?


For CF. Highlight the row header (ie 3) formatconditional
formattingformula is
=a3=max(3:3)
format as desired.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Steph" wrote in message
...
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
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
finding greatest (or least) date associated with given value sprocideon Excel Discussion (Misc queries) 2 June 23rd 06 07:43 AM
Finding the greatest value t2true Excel Discussion (Misc queries) 4 March 21st 06 01:48 AM
Greatest to smallest Dug Excel Discussion (Misc queries) 3 December 4th 05 06:58 PM
Displaying Greatest to Least? Losse Excel Discussion (Misc queries) 2 July 14th 05 08:22 PM
How to filter by greatest of Ruthless Techno Wienee Excel Worksheet Functions 2 November 9th 04 05:17 PM


All times are GMT +1. The time now is 07:15 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"