Dim D as doubleD = Excel.WorksheetFunction.Min(Sheets("Расчёты").Range(Cells(7, i), Cells(13, i)))
d = Excel.WorksheetFunction.Match(Excel.WorksheetFunction.Min(Sheets("Расчёты").Range(Cells(7, i), Cells(13, i))), Sheets("расчёты").Range(Cells(7, i), Cells(13, i)), 0)
Public Sub Рацион()Dim A As Integer, B As Integer, i As Byte, j As Byte, Ñ As Integer, D As Doublei = 43With Sheets("Расчёты")Do While i >= 19j = 20Do While j >= 17A = Excel.WorksheetFunction.Min(.Range(Cells(2, i), Cells(6, i)))B = Excel.WorksheetFunction.Min(.Range(Cells(7, i), Cells(13, i)))If A * .Range("R15") < B ThenF = Excel.WorksheetFunction.Match(Excel.WorksheetFunction.Min(.Range(Cells(2, i), Cells(6, i))), .Range(Cells(2, i), Cells(6, i)), 0).Cells(j, i) = .Cells(j, F).ValueElseC = .Cells(j, i)D = Excel.WorksheetFunction.Match(Excel.WorksheetFunction.Min(.Range(Cells(7, i), Cells(13, i))), .Range(Cells(7, i), Cells(13, i)), 0).Cells(j, i) = .Cells(j, D).ValueEnd Ifj = j - 1Loopi = i - 2LoopEnd WithEnd Sub