Here is an alternative VBA solution.
Option Explicit
Sub HTH()
Dim dMax As Double
Dim lRow As Long
With Sheet1 'Sheet CodeName
dMax = WorksheetFunction.Max(.Columns(8))
If dMax > 0 Then
'Use Find Method
lRow = .Columns(8).Find(What:=dMax, After:=.Cells(1, 8), LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Row
'MsgBox "Row number with " & dMax & " is: " & lRow
End If
Rows(lRow).EntireRow.Copy Sheets("Sheet2").Range("A2")
End With
End Sub
How to install your new code
- Copy the Excel VBA code
- Select the workbook in which you want to store the Excel VBA code
- Press Alt+F11 to open the Visual Basic Editor
- Choose Insert > Module
- Edit > Paste the macro into the module that appeared
- Close the VBEditor
- Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)
To run the Excel VBA code:- Press Alt-F8 to open the macro list
- Select a macro in the list
- Click the Run button
Bookmarks