Im trying to creat a program that finds the highest magnitude value in a column and returns the value value of the cell to the right of it.
When I run my code it just returns nothing in the VLOOKUP cell. `
Sub maxMoment()
Dim j As Integer
j = 1
Dim max As Single
max = 0
For i = 0 To (l + 0.1) Step 0.1
If Abs(max) < Abs(Cells(j, 47)) Then
max = Cells(j, 47)
End If
j = j + 1
Next i
Range("H21").Select
ActiveCell.Value = max
Range("H22").Select
ActiveCell.Value = Application.WorksheetFunction.VLookup(max, Sheet1.Range("AU:AV"), 2)
End Sub
` Any tips would be greatly appreciated.