Reputation: 47
Can anyone help to correct the code? It is always return zero, why? I want to compare the datas in columns H, and extract the value, store in offset(1,2). Please help to check my error, thanks very much
Dim Highest As Double
Highest = Application.WorksheetFunction.Max(Columns("H"))
wkbCrntWorkBook.Activate
ActiveCell.Offset(1, 2).Value = Highest
Upvotes: 1
Views: 1564
Reputation: 55682
Try this instead - this is an array formula in VBA
which converts text to numbers for the Max
function.
Dim Highest As Double
Highest = Evaluate("Max(H:H*1)")
Upvotes: 2