Akina, ошибка при вызове процедуры, дебаггер показывает именно на строку Private Sub CommandButton4_Click(). Код функций:
| Код | Private Function GetAP(cat As Integer) As Single Select Case cat Case 1 GetAP = Sheets("Лист2").Cells(15, 1).Value Case 2 GetAP = Sheets("Лист2").Cells(15, 3).Value Case 3 GetAP = Sheets("Лист2").Cells(15, 5).Value Case 4 GetAP = Sheets("Лист2").Cells(15, 7).Value End Select End Function Private Function GetDI(ColNum As Integer, cat As Integer) As Single Dim i, FullCnt, CatCntRte, CatCntRb, CatCntRgr, CatCntDuDi, CatCntC1Str, CatCntRbPlus, CatCntRgpPlus, CatCntDuDiPlus, CatCntRrast As Integer Dim TempRte, TempRb, TempRgr, TempDuDi, TempC1Str, TempRbPlus, TempRgrPlus, TempDuDiPlus, TempRrast As Single i = 2 FullCnt = 0 CatCntRte = 0 CatCntRb = 0 CatCntRgr = 0 CatCntDuDi = 0 CatCntC1Str = 0 CatCntRbPlus = 0 CatCntRgrPlus = 0 CatCntDuDiPlus = 0 CatCntRrast = 0 While Sheets("Лист1").Cells(i, 33).Value <> "" If Sheets("Лист1").Cells(i, 33).Value = cat Then FullCnt = FullCnt + 1 If Sheets("Лист1").Cells(i, 6).Value = Sheets("Лист1").Cells(ColNum, 6).Value Then CatCntRte = CatCntRte + 1 End If If Sheets("Лист1").Cells(i, 11).Value = Sheets("Лист1").Cells(ColNum, 11).Value Then CatCntRb = CatCntRb + 1 End If If Sheets("Лист1").Cells(i, 14).Value = Sheets("Лист1").Cells(ColNum, 14).Value Then CatCntRgr = CatCntRgr + 1 End If If Sheets("Лист1").Cells(i, 15).Value = Sheets("Лист1").Cells(ColNum, 15).Value Then CatCntDuDi = CatCntDuDi + 1 End If If Sheets("Лист1").Cells(i, 17).Value = Sheets("Лист1").Cells(ColNum, 17).Value Then CatCntC1Str = CatCntC1Str + 1 End If If Sheets("Лист1").Cells(i, 22).Value = Sheets("Лист1").Cells(ColNum, 22).Value Then CatCntRbPlus = CatCntRbPlus + 1 End If If Sheets("Лист1").Cells(i, 25).Value = Sheets("Лист1").Cells(ColNum, 25).Value Then CatCntRgrPlus = CatCntRgrPlus + 1 End If If Sheets("Лист1").Cells(i, 26).Value = Sheets("Лист1").Cells(ColNum, 26).Value Then CatCntDuDiPlus = CatCntDuDiPlus + 1 End If If Sheets("Лист1").Cells(i, 30).Value = Sheets("Лист1").Cells(ColNum, 30).Value Then CatCntRrast = CatCntRrast + 1 End If End If i = i + 1 Wend TempRte = CatCntRte / FullCnt TempRb = CatCntRb / FullCnt TempRgr = CatCntRgr / FullCnt TempDuDi = CatCntDuDi / FullCnt TempC1Str = CatCntC1Str / FullCnt TempRbPlus = CatCntRbPlus / FullCnt TempRgrPlus = CatCntRgrPlus / FullCnt TempDuDiPlus = CatCntDuDiPlus / FullCnt TempRrast = CatCntRrast / FullCnt GetDI = TempRte * TempRb * TempRgr * TempDuDi * TempC1Str * TempRbPlus * TempRgrPlus * TempDuDiPlus * TempRrast End Function
|
|