user1828786
user1828786

Reputation: 47

Error extract max value in a columns. VBA ( it is always return zero, why?)

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

Answers (1)

brettdj
brettdj

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

Related Questions