View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Himani[_2_] Himani[_2_] is offline
external usenet poster
 
Posts: 22
Default Selecting the one with the bigest amount

Find attached code

Sub ChkMaxVal()
Dim lngMax As Long
Dim lngMaxCell
Dim intCol As Integer
Dim lngRow As Long
Dim LastCell

lngMax = Sheets("Sheet2").Cells(2, 2).Value
Sheets("Sheet2").Cells(1, 1).Select
LastCell = ActiveCell.SpecialCells(xlCellTypeLastCell).Addres s
For intCol = 2 To 4
For lngRow = 2 To Mid(LastCell, InStr(2, LastCell, "$") + 1)
If Sheets("Sheet2").Cells(lngRow, intCol).Value lngMax Then
lngMax = Sheets("Sheet2").Cells(lngRow, intCol).Value
lngMaxCell = Sheets("Sheet2").Cells(lngRow, intCol).Address
End If
Next
Next
Sheets("sheet2").Range(lngMaxCell).Select
Selection.Font.Bold = True
MsgBox "Done"
End Sub

"Ruslan" wrote:

Using VB I have to select (or make it bold) the Name in a columnn below that
has the biggest amount:

Name Amounts

Mike 2000 3000 2300 3500 ...
Tom 2700 3900 2100 1500 ...
Sam 1000 7000 1750 500 ...

I'd appreciate your help!
Thank you in advance