Reputation: 13
i have a worksheet with some rows and columns
i want to paste maximum values from certain rows iteratively into a cell using vb.net
i write the code but it giving the error
please look in to this problem and guide me
For i3 As Integer = 5 To rows2
With oWs
**.cells(11, i3).formula = "=max(.range(E & i3 & : j & i3 ))"**
End With
Next
highlighted portion showing the error message
please guide me
gvg
Upvotes: 0
Views: 801
Reputation: 19574
Your formula is a spreadhseet formula, not a VBA application.WorksheetFunction
, so, therefore you need to enter it as text, not as a range - Try this:
.cells(11, i3).formula = "=max(E" & i3 & ":J" & i3 & ")"
Upvotes: 1