Решение экономических задач с помощью VBAРефераты >> Программирование и компьютеры >> Решение экономических задач с помощью VBA
i = 0
Do
i = i + 1
If AA_2(i) < Min Then
Min = AA_2(i)
mm2 = i
End If
Loop Until i = 9
Worksheets("Задание3").Cells(mm2 + 2, 8).Value = "Миним. Цена на товар"
'''''''''''''''''''''''''''''
i = 0
Do
i = i + 1
MM_1(i) = Worksheets("Задание3").Cells(i + 2, 2).Value
MM_2(i) = Worksheets("Задание3").Cells(i + 2, 3).Value
MM_3(i) = Worksheets("Задание3").Cells(i + 2, 4).Value
MM_4(i) = Worksheets("Задание3").Cells(i + 2, 5).Value
MM_5(i) = Worksheets("Задание3").Cells(i + 2, 6).Value
Loop Until i = 9
'''' 1
Min = 100000
i = 0
Do
i = i + 1
If MM_1(i) < Min Then
Min = MM_1(i)
x1 = i
End If
Loop Until i = 9
Worksheets("Задание3").Cells(x1 + 2, 2).Font.Bold = True
Worksheets("Задание3").Cells(x1 + 2, 2).Font.Size = 11
Worksheets("Задание3").Cells(x1 + 2, 2).Font.Italic = True
'''' 2
Min = 100000
i = 0
Do
i = i + 1
If MM_2(i) < Min Then
Min = MM_2(i)
x2 = i
End If
Loop Until i = 9
Worksheets("Задание3").Cells(x2 + 2, 3).Font.Bold = True
Worksheets("Задание3").Cells(x2 + 2, 3).Font.Size = 11
Worksheets("Задание3").Cells(x2 + 2, 3).Font.Italic = True
'''' 3
Min = 100000
i = 0
Do
i = i + 1
If MM_3(i) < Min Then
Min = MM_3(i)
x3 = i
End If
Loop Until i = 9
Worksheets("Задание3").Cells(x3 + 2, 4).Font.Bold = True
Worksheets("Задание3").Cells(x3 + 2, 4).Font.Size = 11
Worksheets("Задание3").Cells(x3 + 2, 4).Font.Italic = True
'''' 4
Min = 100000
i = 0
Do
i = i + 1
If MM_4(i) < Min Then
Min = MM_4(i)
x4 = i
End If
Loop Until i = 9
Worksheets("Задание3").Cells(x4 + 2, 5).Font.Bold = True
Worksheets("Задание3").Cells(x4 + 2, 5).Font.Size = 11
Worksheets("Задание3").Cells(x4 + 2, 5).Font.Italic = True
'''' 5
Min = 100000
i = 0
Do
i = i + 1
If MM_5(i) < Min Then
Min = MM_5(i)
x5 = i
End If
Loop Until i = 9
Worksheets("Задание3").Cells(x5 + 2, 6).Font.Bold = True
Worksheets("Задание3").Cells(x5 + 2, 6).Font.Size = 11
Worksheets("Задание3").Cells(x5 + 2, 6).Font.Italic = True
'''' 6
End Sub
Sub Task5()
Worksheets("Задание5").Activate
End Sub
Sub Task6()
Worksheets("Задание5").Activate
End Sub
Sub Task5_Evrica()
Dim G(4, 4)
Dim c(4)
c(1) = Worksheets("Задание5").Range("a1")
c(2) = Worksheets("Задание5").Range("b1")
c(3) = Worksheets("Задание5").Range("c1")
c(4) = Worksheets("Задание5").Range("d1")
Worksheets("Задание5").Range("a3:d6").Value = ""
For i = 1 To 4
For j = 1 To 4
If i <= j + 1 Then G(i, j) = c(i) * (Cos(c(j))) ^ 2
If i > j + 1 Then G(i, j) = Abs(c(i - j) ^ 3 - c(i))
Next
Next
For i = 1 To 4
For j = 1 To 4
Worksheets("Задание5").Cells(i + 2, j).Value = G(i, j)
Next
Next
End Sub
Sub Task6_Evrica()
Dim X(4)
Dim Y(4)
X(1) = Worksheets("Задание5").Range("a12")
X(2) = Worksheets("Задание5").Range("a13")
X(3) = Worksheets("Задание5").Range("a14")
X(4) = Worksheets("Задание5").Range("a15")
Y(1) = Worksheets("Задание5").Range("b12")
Y(2) = Worksheets("Задание5").Range("b13")
Y(3) = Worksheets("Задание5").Range("b14")
Y(4) = Worksheets("Задание5").Range("b15")
s1 = 0
s2 = 0
s3 = 0
m = 4
For i = 1 To m
s1 = s1 + X(i)
s2 = s2 + X(i) * Y(i)
s3 = s3 + X(i) * X(i)
Next
s = (2 * s1 + s2) * (2 - s1) + 3 + s3
Worksheets("Задание5").Range("D15").Value = s
End Sub
Sub Task7()
Worksheets("Раскрой").Activate
End Sub
Sub Task7_DB()
UserForm1.ComboBox1.Clear
UserForm1.ComboBox2.Clear
UserForm1.ComboBox3.Clear
UserForm1.ComboBox1.AddItem ("Директор")
UserForm1.ComboBox1.AddItem ("Зам. директора")
UserForm1.ComboBox1.AddItem ("Менеджер")
UserForm1.ComboBox1.AddItem ("Сектетарь")
UserForm1.ComboBox1.AddItem ("Администратор")
UserForm1.ComboBox1.AddItem ("Охрана")
UserForm1.ComboBox1.AddItem ("Водитель")
UserForm1.ComboBox1.AddItem ("Сторож")
UserForm1.ComboBox1.AddItem ("Уборщик")
UserForm1.ComboBox2.AddItem ("10 лет.")
UserForm1.ComboBox2.AddItem ("9 лет.")
UserForm1.ComboBox2.AddItem ("8 лет.")
UserForm1.ComboBox2.AddItem ("3 года.")
UserForm1.ComboBox2.AddItem ("2 года.")
UserForm1.ComboBox2.AddItem ("1 год.")
UserForm1.ComboBox2.AddItem ("меньше года.")
UserForm1.ComboBox3.AddItem ("5 часов")
UserForm1.ComboBox3.AddItem ("6 часов")
UserForm1.ComboBox3.AddItem ("7 часов")
UserForm1.ComboBox3.AddItem ("8 часов")
UserForm1.Show
End Sub
Sub Task7_List()
Worksheets("БД").Activate
End Sub
Sub Model_of_storekeeping()
UserForm2.Show
End Sub
Модуль 3:
Option Explicit
'МОДЕЛЬ УПРАВЛЕНИЯ ЗАПАСАМИ
Function CALC(buy As Variant) As Variant
Dim Цена_продажы, Цена_покупки, Цена_возврата, NRows, i, j As Integer, Result() As Integer
NRows = buy.Rows.Count
Цена_продажы = Range("a2").Value
Цена_покупки = Range("b2").Value
Цена_возврата = Range("c2").Value
ReDim Result(NRows, NRows)
For i = 1 To NRows
For j = 1 To NRows
If i <= j Then Result(i, j) = buy(i) * (Цена_продажы - Цена_покупки)
If i > j Then Result(i, j) = buy(j) * (Цена_продажы - Цена_покупки) - (buy(i) - buy(j)) * (Цена_покупки - Цена_возврата)
Next j
Next i
CALC = Result
End Function
Sub Begin()
Worksheets("Содержание").Activate
End Sub
Sub Optimum_capital_investmentsEVR()
Dim i, j, k, n, p, l, t As Integer
Dim m, r(), A() As Double
k = 7
ReDim r(k + 1, 6), A(k + 1)
For i = 1 To k + 1
For j = 2 To 7
r(i, j - 1) = Cells(i + 3, j).Value
Next j
Next i
t = 2
For p = 2 To 6
If p = 2 Then
For j = 1 To k + 1
A(j) = Cells(j + 3, 2).Value
Next j
End If
If p > 2 Then
For j = 1 To k + 1
A(j) = Cells(j + 3, p + 5).Value
Next j
End If
For n = 1 To k + 1
m = -1
For j = 1 To n