Go to the Max
Sub GoToMax()
Dim WorkRange As Range
If TypeName(Selection) <> "Range" Then Exit Sub
If Selection.Count = 1 Then
Set WorkRange = Cells
Else
Set WorkRange = Selection
End If
MaxVal = Application.Max(WorkRange)
On Error Resume Next
WorkRange.Find(What:=MaxVal, _
After:=WorkRange.Range("A1"), _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False _
).Select
If Err <> 0 Then MsgBox "Max value was not found: " _
& MaxVal
End Sub
Related examples in the same category
1. | Check the existence of ActiveCell | | |
2. | Moves the active cell up two rows (RowOffset:=-2) and four columns to the right (ColumnOffset:=4): | | |
3. | Entering Text in the Current Cell | | |
4. | Take the current text value, and add the message "INVALID: " before the text | | |
5. | Entering a Formula in a Cell | | |
6. | Use all the ordinary numeric operators, like +, -, /, *, and ^. | | |
7. | Moving to Other Cells | | |
8. | Move to the new cell, you need to use the Activate or Select method | | |
9. | Get the address of ActiveCell | | |
10. | Activate Change | | |
11. | Select active cell and up to the end | | |
12. | Select ActiveCell and cells to its Right | | |
13. | Select ActiveCell and cells to its Left | | |
14. | Select ActiveCell's range | | |
15. | Use ActiveCell.SpecialCells(xlLastCell) | | |
16. | Use ActiveCell.Offset to move the curren selection | | |
17. | Move the active cell by using ActiveCell.Offset | | |
18. | Swap Text With Cell On Right | | |
19. | Copy the value from the variable into the cell on the right. | | |
20. | If the value of the active cell is too big, change it | | |
21. | Use if, ElseIf and Else with ActiveCell | | |
22. | Repeating Actions with a Loop | | |
23. | Accesses the PROPER( ) function through the Application.WorksheetFunction object. | | |
24. | Do-While loop with ActiveCell | | |
25. | Use Do Loop While to change ActiveCell value | | |
26. | Do-Until loop and IsEmpty | | |
27. | a Do-Loop Until loop with IsEmpty | | |
28. | Uses the EntireColumn property, which returns a Range object that consists of a full column: | | |
29. | Select Current Region | | |
30. | Select Active Column | | |
31. | Select Active Row | | |
32. | Activate Next Blank Down | | |
33. | Activate Next Blank To Right | | |
34. | Select First To Last In Row | | |
35. | Select First To Last In Column | | |
36. | Toggles text wrap alignment for selected cells | | |
37. | Store the location of the active cell and then return it to the stored location | | |
38. | Working with the Region around the Active Cell | | |