It depends on how you're using .Max. Here's one way:
VBA Code:Sub test2() x = WorksheetFunction.Max(Range("M:M")) MsgBox Range("M:M").Find(x).Address End Sub
It depends on how you're using .Max. Here's one way:
VBA Code:Sub test2() x = WorksheetFunction.Max(Range("M:M")) MsgBox Range("M:M").Find(x).Address End Sub
Dim rng As Range, cell As Range
Dim first As String
Dim firstlocval As Range
Dim firstloc As Range
Dim second As String
Dim third As String
Dim fourth As String
Dim fifth As String
Set rng = Range("Y32:Y57")
first = WorksheetFunction.Max(Range("Y32:Y57"))
Set firstloc = Range("Y32:Y57").Find(first).Address
Set firstlocval = firstloc.Offset(0, -2)
MsgBox (firstlocval)
If you want to point firstloc at the cell, take the Address method off:
VBA Code:Set firstloc = Range("Y32:Y57").Find(first)
Sub cTest()
Dim first As String
first = WorksheetFunction.Max(Range("Y32:Y57"))
MsgBox first
End Sub
What value is in Y39?
What Value is in Y50?
What does the code below produce?
VBA Code:Sub cTest() Dim first As String first = WorksheetFunction.Max(Range("Y32:Y57")) MsgBox first End Sub
I suspect that you will need to specify certain parameters in the Find.
Sub dTest()
Dim first As Long
Dim firstlocval As Range
Dim firstloc As Range
first = WorksheetFunction.Max(Range("Y32:Y57"))
Set firstloc = Range("Y32:Y57").Find(first)
Set firstlocval = firstloc.Offset(0, -2)
MsgBox (firstlocval)
End Sub