Hey guys
I am working on this code and my plan is to go into a worksheet, get the max of column A. And if the max is found then go to the next row over and get the name associated with it. I wrote this code and the value of the name is coming up blank and I don’t what I am doing wrong.
Dim returnVal (2), rg, rg2 as variant
Dim krow as long
Dim Ws1 As worksheet
krow = ws1.Cells(Rows.Count,1).End(xlUp).Row
With Ws1
returnVal(0) = Application.WorksheerFunction.Max (.Range(“A1:A” & krow).SpecialCells(xlTypeVisible))
Set rg = .Range(“A1:A” & krow).Find(returnVal(0), , xlValues, xlWhole, , False, False, False)
If Not rg is Nothing Then
rg2 = rg.Offset(0,1).Value
returnVal(1) = rg2
Set rg = Nothing
End if
End with
I am working on this code and my plan is to go into a worksheet, get the max of column A. And if the max is found then go to the next row over and get the name associated with it. I wrote this code and the value of the name is coming up blank and I don’t what I am doing wrong.
Dim returnVal (2), rg, rg2 as variant
Dim krow as long
Dim Ws1 As worksheet
krow = ws1.Cells(Rows.Count,1).End(xlUp).Row
With Ws1
returnVal(0) = Application.WorksheerFunction.Max (.Range(“A1:A” & krow).SpecialCells(xlTypeVisible))
Set rg = .Range(“A1:A” & krow).Find(returnVal(0), , xlValues, xlWhole, , False, False, False)
If Not rg is Nothing Then
rg2 = rg.Offset(0,1).Value
returnVal(1) = rg2
Set rg = Nothing
End if
End with