MAX and SQRT are worksheet functions, not VBA functions. Some worksheet
functions can be used in your VBA code, if you specify them as
Application.WorksheetFunction.FUNCTION, where FUNCTION is one of the available
worksheet functions. With this change, your code looks like this:
Sub xformula()
Dim i As Double, k As Double, q As Double
q = Worksheets("input").Range("e12").Value
For i = 1 To q
k = Worksheets("input").Cells(14 + i, 6).Value
Cells(11 + i, 7).Value = 1 + (Application.WorksheetFunction.Max(Cells(11
+ i, 5).Value, 0.2) - 1) / Application.WorksheetFunction.Sqrt(k)
Next i
End Sub
I haven't tested this, but it compiles correctly. Also, SQRT() applied to to
negative number will generate an error.